From 2e7e75a2a9846f8903cd10137d88ba50c4151397 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Mon, 21 Nov 2022 20:13:29 -0600 Subject: [PATCH] Return error from FSMakeFSSpec if file not found (#58) Fixes #56 --- toolbox/os_highlevel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toolbox/os_highlevel.cpp b/toolbox/os_highlevel.cpp index 0d84de1..4000e64 100644 --- a/toolbox/os_highlevel.cpp +++ b/toolbox/os_highlevel.cpp @@ -106,8 +106,6 @@ namespace OS { { // FSMakeFSSpec(vRefNum: Integer; dirID: LongInt; fileName: Str255; VAR spec: FSSpec): OSErr; - // todo -- if the file does not exist (but the path is otherwise valid), create the spec but return fnfErr. - /* * See Chapter 2, File Manager / Using the File Manager, 2-35 * @@ -176,7 +174,9 @@ namespace OS { // write the filename... ToolBox::WritePString(spec + 6, leaf); - return 0; + struct stat st; + int rv = ::stat(sname.c_str(), &st); + if (rv < 0) return macos_error_from_errno(); } else