Skip to content
Snippets Groups Projects
Commit 8cfbd422 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix macOS bug where the *first* entry on a new system could not be added

When the code to use URLForDirectory to get paths was written, it
didn't create the paths, so the files in them could not be created
either.

If SyncTERM had ever ran using the old FSFindFolder() method, the
path would already exist, so things would work.

Also, since we're here, use mkpath() instead of MKDIR().
parent 8212cdf5
No related branches found
No related tags found
No related merge requests found
Pipeline #6833 passed
......@@ -2,6 +2,7 @@ Version 1.2rc3
--------------
Get Haiku support building again
Properly quit video subsystem from video thread - fixes Haiku crash
Create dirs on macOS when needed - fixes adding first BBS
Version 1.2rc2
--------------
......
......@@ -38,21 +38,32 @@ get_OSX_filename(char *fn, int fnlen, int type, int shared)
return NULL;
}
strlcpy(fn, result.path.UTF8String, fnlen);
if (type == SYNCTERM_DEFAULT_TRANSFER_PATH) {
strlcat(fn, "/", fnlen);
return fn;
}
switch(type) {
case SYNCTERM_PATH_INI:
strlcat(fn, "/Preferences/SyncTERM/SyncTERM.ini", fnlen);
strlcat(fn, "/Preferences/SyncTERM", fnlen);
mkpath(fn);
strlcat(fn, "/SyncTERM.ini", fnlen);
break;
case SYNCTERM_PATH_LIST:
strlcat(fn, "/Preferences/SyncTERM/SyncTERM.lst", fnlen);
break;
case SYNCTERM_DEFAULT_TRANSFER_PATH:
strlcat(fn, "/", fnlen);
strlcat(fn, "/Preferences/SyncTERM", fnlen);
mkpath(fn);
strlcat(fn, "/SyncTERM.lst", fnlen);
break;
case SYNCTERM_PATH_CACHE:
strlcat(fn, "/SyncTERM/", fnlen);
strlcat(fn, "/SyncTERM", fnlen);
mkpath(fn);
strlcat(fn, "/", fnlen);
break;
case SYNCTERM_PATH_KEYS:
strlcat(fn, "/Preferences/SyncTERM/SyncTERM.ssh", fnlen);
strlcat(fn, "/Preferences/SyncTERM", fnlen);
mkpath(fn);
strlcat(fn, "/SyncTERM.ssh", fnlen);
break;
}
......
......@@ -1093,7 +1093,7 @@ get_win_filename(char *fn, int fnlen, int type, int shared)
/* Create if it doesn't exist */
if (*fn && !isdir(fn)) {
if (MKDIR(fn))
if (mkpath(fn))
return NULL;
}
......@@ -1165,6 +1165,13 @@ get_haiku_filename(char *fn, int fnlen, int type, int shared)
sz = strlcat(fn, "/SyncTERM", fnlen);
if (sz >= fnlen)
return NULL;
/* Create if it doesn't exist */
if (!isdir(fn) && !shared) {
if (mkpath(fn))
return NULL;
}
if (type == SYNCTERM_PATH_CACHE)
return fn;
......@@ -1289,7 +1296,7 @@ get_unix_filename(char *fn, int fnlen, int type, int shared)
/* Create if it doesn't exist */
if (!isdir(fn) && !shared) {
if (MKDIR(fn))
if (mkpath(fn))
return NULL;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment