Skip to content

Commit 92b1788

Browse files
committed
Platform: refactor; remove extra /
1 parent efdbeb5 commit 92b1788

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/util/platform/FFPlatform_unix.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88

99
static void getHomeDir(FFPlatform* platform, const struct passwd* pwd)
1010
{
11-
const char* home = getenv("HOME");
12-
if(!ffStrSet(home) && pwd)
13-
home = pwd->pw_dir;
14-
11+
const char* home = pwd ? pwd->pw_dir : getenv("HOME");
1512
ffStrbufAppendS(&platform->homeDir, home);
1613
ffStrbufEnsureEndsWithC(&platform->homeDir, '/');
1714
}
@@ -44,11 +41,11 @@ static void getConfigDirs(FFPlatform* platform)
4441
ffPlatformPathAddEnv(&platform->configDirs, "XDG_CONFIG_DIRS");
4542

4643
#if !defined(__APPLE__)
47-
ffPlatformPathAddAbsolute(&platform->configDirs, FASTFETCH_TARGET_DIR_ETC"/xdg/");
44+
ffPlatformPathAddAbsolute(&platform->configDirs, FASTFETCH_TARGET_DIR_ETC "/xdg/");
4845
#endif
4946

50-
ffPlatformPathAddAbsolute(&platform->configDirs, FASTFETCH_TARGET_DIR_ETC"/");
51-
ffPlatformPathAddAbsolute(&platform->configDirs, FASTFETCH_TARGET_DIR_INSTALL_SYSCONF"/");
47+
ffPlatformPathAddAbsolute(&platform->configDirs, FASTFETCH_TARGET_DIR_ETC "/");
48+
ffPlatformPathAddAbsolute(&platform->configDirs, FASTFETCH_TARGET_DIR_INSTALL_SYSCONF "/");
5249
}
5350

5451
static void getDataDirs(FFPlatform* platform)
@@ -57,13 +54,13 @@ static void getDataDirs(FFPlatform* platform)
5754
ffPlatformPathAddHome(&platform->dataDirs, platform, ".local/share/");
5855

5956
#if defined(__APPLE__)
60-
ffPlatformPathAddHome(&platform->dataDirs, platform, "/Library/Application Support/");
57+
ffPlatformPathAddHome(&platform->dataDirs, platform, "Library/Application Support/");
6158
#endif
6259

6360
ffPlatformPathAddHome(&platform->dataDirs, platform, "");
6461
ffPlatformPathAddEnv(&platform->dataDirs, "XDG_DATA_DIRS");
65-
ffPlatformPathAddAbsolute(&platform->dataDirs, FASTFETCH_TARGET_DIR_USR"/local/share/");
66-
ffPlatformPathAddAbsolute(&platform->dataDirs, FASTFETCH_TARGET_DIR_USR"/share/");
62+
ffPlatformPathAddAbsolute(&platform->dataDirs, FASTFETCH_TARGET_DIR_USR "/local/share/");
63+
ffPlatformPathAddAbsolute(&platform->dataDirs, FASTFETCH_TARGET_DIR_USR "/share/");
6764
}
6865

6966
static void getUserName(FFPlatform* platform, const struct passwd* pwd)

0 commit comments

Comments
 (0)