-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS : wrong current directory when launched from command line #188
Comments
try: make osx-package This will make an app with all the needed resources inside |
Tried and got :
|
Try: Also you can try this code snipped replacing the one around 'chdir':
Please, give feedback of results. |
|
But the snippet solves the problem ! |
Great! I'll commit the change. |
About make PLATFORM=osx package-osx macOS app is built under the Oricutron_osx_v12 directory, but when launching from the desktop (app in the same place, didn't tried from the Applications directory) :
If I remember well I've got the same problem with macOS version from http://www.petergordon.org.uk/oricutron/ I'm under macOS 10.15.7 and I see this diagnostic message :
|
And the 3 steps up levels problem is back :-( The code snippet worked, but then 2e3f760 negated (on purpose I presume) the CFURLGetFileSystemRepresentation() call, which cause the chdir(path) to execute and BAAM!, wrong dir for tapes and disks |
If nobody else is working on this presently, I'm happy to pick this up,
Happy to hear your feedback on this. |
Purpose of this change: * To make Oricutron runnable without cd'ing to its directory first * To support relative paths with the -t option * On macOS, to help command line users by not requiring a bundled app, allow "./oricutron" in the source directory much like under Linux. * To make the macOS version runnable from the source directory like you might expect if coming from Linux, e.g. by "make && ./oricutron". Code changes: * Factor out FILEPREFIX from ROMPREFIX and IMAGEPREFIX constants * Apply FILEPREFIX for all filenames in oricutron.cfg which was done previously only for the keymap path * Let function get_fileprefix() replace the FILEPREFIX constant, and use run-time concatenation instead of compile-time * For Linux let get_fileprefix() return program binary's directory * For macOS, let get_fileprefix() return parent of .app bundle if the program is bundled, otherwise do as in Linux. path fixup
Purpose of this change: * To make Oricutron runnable without cd'ing to its directory first * To support relative paths with the -t option * On macOS, to help command line users by not requiring a bundled app, allow "./oricutron" in the source directory much like under Linux. * To make the macOS version runnable from the source directory like you might expect if coming from Linux, e.g. by "make && ./oricutron". Code changes: * Factor out FILEPREFIX from ROMPREFIX and IMAGEPREFIX constants * Apply FILEPREFIX for all filenames in oricutron.cfg which was done previously only for the keymap path * Let function get_fileprefix() replace the FILEPREFIX constant, and use run-time concatenation instead of compile-time * For Linux let get_fileprefix() return program binary's directory * For macOS, let get_fileprefix() return parent of .app bundle if the program is bundled, otherwise do as in Linux. path fixup
Purpose of this change: * To make Oricutron runnable without cd'ing to its directory first * To support relative paths with the -t option * On macOS, to help command line users by not requiring a bundled app, allow "./oricutron" in the source directory much like under Linux. * To make the macOS version runnable from the source directory like you might expect if coming from Linux, e.g. by "make && ./oricutron". Code changes: * Factor out FILEPREFIX from ROMPREFIX and IMAGEPREFIX constants * Apply FILEPREFIX for all filenames in oricutron.cfg which was done previously only for the keymap path * Let function get_fileprefix() replace the FILEPREFIX constant, and use run-time concatenation instead of compile-time * For Linux let get_fileprefix() return program binary's directory * For macOS, let get_fileprefix() return parent of .app bundle if the program is bundled, otherwise do as in Linux.
Purpose of this change: * To make Oricutron runnable without cd'ing to its directory first * To support relative paths with the -t option * On macOS, to help command line users by not requiring a bundled app, allow "./oricutron" in the source directory much like under Linux. * To make the macOS version runnable from the source directory like you might expect if coming from Linux, e.g. by "make && ./oricutron". Code changes: * Factor out FILEPREFIX from ROMPREFIX and IMAGEPREFIX constants * Apply FILEPREFIX for all filenames in oricutron.cfg which was done previously only for the keymap path * Let function get_fileprefix() replace the FILEPREFIX constant, and use run-time concatenation instead of compile-time * For Linux let get_fileprefix() return program binary's directory * For macOS, let get_fileprefix() return parent of .app bundle if the program is bundled, otherwise do as in Linux.
Purpose of this change: * To make Oricutron runnable without cd'ing to its directory first * To support relative paths with the -t option * On macOS, to help command line users by not requiring a bundled app, allow "./oricutron" in the source directory much like under Linux. * To make the macOS version runnable from the source directory like you might expect if coming from Linux, e.g. by "make && ./oricutron". Code changes: * Factor out FILEPREFIX from ROMPREFIX and IMAGEPREFIX constants * Apply FILEPREFIX for all filenames in oricutron.cfg which was done previously only for the keymap path * Let function get_fileprefix() replace the FILEPREFIX constant, and use run-time concatenation instead of compile-time * For Linux let get_fileprefix() return program binary's directory * For macOS, let get_fileprefix() return parent of .app bundle if the program is bundled, otherwise do as in Linux.
Purpose of this change: * To make Oricutron runnable without cd'ing to its directory first * To support relative paths with the -t option * On macOS, to help command line users by not requiring a bundled app, allow "./oricutron" in the source directory much like under Linux. * To make the macOS version runnable from the source directory like you might expect if coming from Linux, e.g. by "make && ./oricutron". Code changes: * Factor out FILEPREFIX from ROMPREFIX and IMAGEPREFIX constants * Apply FILEPREFIX for all filenames in oricutron.cfg which was done previously only for the keymap path * Let function get_fileprefix() replace the FILEPREFIX constant, and use run-time concatenation instead of compile-time * For Linux let get_fileprefix() return program binary's directory * For macOS, let get_fileprefix() return parent of .app bundle if the program is bundled, otherwise do as in Linux.
I've build oricutron from command line (with a simple make, not Xcode)
What I got is a simple terminal app (not an OSX application), so far so good.
Unfortunately when oricutron starts, it sets the current directory 3 levels upper the current one making the -t flag unusable.
The offending code is around is
oricutron/main.c
Line 1629 in 9e4e3ca
Commenting the chdir() solves the problem, and oricutron happily cload the selected tape file at startup.
Dunno if there's a way to detect if the code is being build with Xcode (maybe a known Xcode define) or not.
The text was updated successfully, but these errors were encountered: