Skip to content

Changed the macOS functionning so it is no more deprecated.#16

Open
sisyffe wants to merge 5 commits into
Malvineous:masterfrom
sisyffe:master
Open

Changed the macOS functionning so it is no more deprecated.#16
sisyffe wants to merge 5 commits into
Malvineous:masterfrom
sisyffe:master

Conversation

@sisyffe

@sisyffe sisyffe commented Jan 1, 2024

Copy link
Copy Markdown

I also created basic tests for macOS and a namespace when compiled in C++. On the previous version we needed to link to Cocoa framework to use the FSFindFolder and FSRefMakePath functions but now the new functions live somewhere else (maybe in libc?)
However while looking in test-win.c, I saw that the user name of the paths were always "test-win" and that should lead to a failed test (I did not tested I don't have windows).

@cxong cxong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR includes several changes like adding test script, replacing deprecated CoreServices, changing default file path etc, it might be better to split this PR so it can be reviewed easier

Comment thread cfgpath.h
#endif

#ifdef __cplusplus
namespace cfgpath {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't add the namespace, it just makes the library usage different for C++ for not much gain

Comment thread cfgpath.h
/* Make the config folder if it doesn't already exist */
mkdir(out, 0755);
strcat(out, PATH_SEPARATOR_STRING);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if glob fails need to set out[0] = '\0'; so the caller knows something went wrong

Comment thread cfgpath.h
* Windows: C:\Users\jcitizen\AppData\Roaming\appname.ini
* Linux: /home/jcitizen/.config/appname.conf
* Mac: /Users/jcitizen/Library/Application Support/appname.conf
* Mac: /Users/jcitizen/Library/Application Support/appname/appname.conf

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while it is better practice for programs to put their files in a folder in application support, this will break backwards compatibility, so I think it's better to leave this unchanged

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either that or add a #define to allow it to go into a subfolder across all platforms.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually that's what get_user_config_folder() is for so better to leave it unchanged so it doesn't produce a filename that might conflict with what get_user_config_folder() returns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants