Skip to content

Commit

Permalink
Creating user settings dirs at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
jszczerbinsky committed Feb 19, 2024
1 parent 5bf368c commit 29912ed
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ void getWlpCfgPath(char *buff, const char *dirPath);
void getAppCfgPath(char *buff);
void getLogPath(char *buff);

void createUserDirs();

//
// monitorScanner.c
//
Expand Down
19 changes: 19 additions & 0 deletions src/common/paths.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@

#include "../common.h"

void createUserDirs()
{
#ifdef __WIN32
const char *format = "%s\\%s";
#else
const char *format = "%s/%s";
#endif

char path[PATH_MAX];

getAppDir(path, APP_DIR_USER_SETTINGS);
sprintf(path, format, path, "wallpapers");
g_mkdir_with_parents(path, 484);

getAppDir(path, APP_DIR_USER_SETTINGS);
sprintf(path, format, path, "monitors");
g_mkdir_with_parents(path, 484);
}

static void removeLastPathEntry(char *path)
{
char *ptr = path + strlen(path) - 1;
Expand Down
2 changes: 2 additions & 0 deletions src/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ int main(int argc, char *argv[])
{
int status;

createUserDirs();

#ifdef __WIN32
initTrayIcon();
#endif
Expand Down

0 comments on commit 29912ed

Please sign in to comment.