Skip to content

Commit 1dd942a

Browse files
TARGET_DIR_ETC
1 parent 2f6613c commit 1dd942a

File tree

9 files changed

+28
-26
lines changed

9 files changed

+28
-26
lines changed

CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,16 @@ if(NOT TARGET_DIR_HOME)
123123
endif()
124124

125125
if(NOT TARGET_DIR_ETC)
126-
set(TARGET_DIR_ETC "${CMAKE_INSTALL_SYSCONFDIR}")
126+
set(TARGET_DIR_ETC "${TARGET_DIR_ROOT}/etc")
127+
endif()
128+
129+
#https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
130+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
131+
set(CMAKE_INSTALL_PREFIX "${TARGET_DIR_USR}" CACHE PATH "..." FORCE)
132+
endif()
133+
134+
if(NOT CMAKE_INSTALL_SYSCONFDIR)
135+
set(CMAKE_INSTALL_SYSCONFDIR "${TARGET_DIR_ETC}" CACHE PATH "..." FORCE)
127136
endif()
128137

129138
#################
@@ -466,15 +475,6 @@ endif()
466475
# install target #
467476
##################
468477

469-
#https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
470-
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
471-
set(CMAKE_INSTALL_PREFIX "${TARGET_DIR_USR}" CACHE PATH "..." FORCE)
472-
endif()
473-
474-
if(NOT CMAKE_INSTALL_SYSCONFDIR)
475-
set(CMAKE_INSTALL_SYSCONFDIR "${TARGET_DIR_ROOT}/etc" CACHE PATH "..." FORCE)
476-
endif()
477-
478478
include(GNUInstallDirs)
479479

480480
install(

src/common/init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ static void initConfigDirs(FFstate* state)
7676

7777
FFstrbuf* systemConfigHome = ffListAdd(&state->configDirs);
7878
ffStrbufInitA(systemConfigHome, 64);
79-
ffStrbufAppendS(systemConfigHome, FASTFETCH_TARGET_DIR_ROOT"/etc/xdg/");
79+
ffStrbufAppendS(systemConfigHome, FASTFETCH_TARGET_DIR_ETC"/xdg/");
8080
FF_ENSURE_ONLY_ONCE_IN_LIST(systemConfigHome)
8181

8282
FFstrbuf* systemConfig = ffListAdd(&state->configDirs);
8383
ffStrbufInitA(systemConfig, 64);
84-
ffStrbufAppendS(systemConfig, FASTFETCH_TARGET_DIR_ROOT"/etc/");
84+
ffStrbufAppendS(systemConfig, FASTFETCH_TARGET_DIR_ETC"/");
8585
FF_ENSURE_ONLY_ONCE_IN_LIST(systemConfig)
8686

8787
#undef FF_ENSURE_ONLY_ONCE_IN_LIST

src/detection/font/font.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ typedef struct FFFontResult
1212
FFstrbuf error;
1313

1414
/**
15-
* Linux / BSD: QT, GTK2, GTK3, GTK4
16-
* MacOS: System, User, Monospace, Application
17-
* Other: Unset, Unset, Unset, Unset
15+
* Linux / BSD: QT, GTK2, GTK3, GTK4
16+
* MacOS: System, User, Monospace, Application
17+
* Other: Unset, Unset, Unset, Unset
1818
*/
1919
FFstrbuf fonts[FF_DETECT_FONT_NUM_FONTS];
2020
} FFFontResult;

src/detection/os/os_linux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static void detectOS(FFOSResult* os, const FFinstance* instance)
101101
return;
102102
}
103103

104-
if(instance->config.escapeBedrock && parseFile(FASTFETCH_TARGET_DIR_ROOT"/bedrock/etc/bedrock-release", os))
104+
if(instance->config.escapeBedrock && parseFile(FASTFETCH_TARGET_DIR_ROOT"/bedrock"FASTFETCH_TARGET_DIR_ETC"/bedrock-release", os))
105105
{
106106
if(os->id.length == 0)
107107
ffStrbufAppendS(&os->id, "bedrock");
@@ -115,15 +115,15 @@ static void detectOS(FFOSResult* os, const FFinstance* instance)
115115
return;
116116
}
117117

118-
parseFile(FASTFETCH_TARGET_DIR_ROOT"/etc/os-release", os);
118+
parseFile(FASTFETCH_TARGET_DIR_ETC"/os-release", os);
119119
if(allRelevantValuesSet(os))
120120
return;
121121

122122
parseFile(FASTFETCH_TARGET_DIR_USR"/lib/os-release", os);
123123
if(allRelevantValuesSet(os))
124124
return;
125125

126-
parseFile(FASTFETCH_TARGET_DIR_ROOT"/etc/lsb-release", os);
126+
parseFile(FASTFETCH_TARGET_DIR_ETC"/lsb-release", os);
127127
}
128128

129129
void ffDetectOSImpl(FFOSResult* os, const FFinstance* instance)

src/detection/terminalfont/terminalfont.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void detectTTY(FFTerminalFontResult* terminalFont)
4242
FFstrbuf fontName;
4343
ffStrbufInit(&fontName);
4444

45-
ffParsePropFile(FASTFETCH_TARGET_DIR_ROOT"/etc/vconsole.conf", "Font =", &fontName);
45+
ffParsePropFile(FASTFETCH_TARGET_DIR_ETC"/vconsole.conf", "Font =", &fontName);
4646

4747
if(fontName.length == 0)
4848
{
@@ -59,7 +59,7 @@ static void detectTTY(FFTerminalFontResult* terminalFont)
5959
if(fontName.length > 0)
6060
ffFontInitCopy(&terminalFont->font, fontName.chars);
6161
else
62-
ffStrbufAppendS(&terminalFont->error, "Couldn't find Font in /etc/vconsole.conf");
62+
ffStrbufAppendS(&terminalFont->error, "Couldn't find Font in "FASTFETCH_TARGET_DIR_ETC"/vconsole.conf");
6363

6464
ffStrbufDestroy(&fontName);
6565
}

src/fastfetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
13081308

13091309
static void parseConfigFileSystem(FFinstance* instance, FFdata* data)
13101310
{
1311-
parseConfigFile(instance, data, FASTFETCH_TARGET_DIR_ETC"/fastfetch/config.conf");
1311+
parseConfigFile(instance, data, FASTFETCH_TARGET_DIR_INSTALL_SYSCONF"/fastfetch/config.conf");
13121312
}
13131313

13141314
static void parseConfigFileUser(FFinstance* instance, FFdata* data)

src/fastfetch_config.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#define FASTFETCH_TARGET_DIR_HOME "@TARGET_DIR_HOME@"
1414
#define FASTFETCH_TARGET_DIR_ETC "@TARGET_DIR_ETC@"
1515

16+
#define FASTFETCH_TARGET_DIR_INSTALL_SYSCONF "@CMAKE_INSTALL_SYSCONFDIR@"
17+
1618
#define FASTFETCH_DATATEXT_STRUCTURE "@DATATEXT_STRUCTURE@"
1719
#define FASTFETCH_DATATEXT_CONFIG_SYSTEM "@DATATEXT_CONFIG_SYSTEM@" //Requires FASTFETCH_PROJECT_VERSION to be set
1820
#define FASTFETCH_DATATEXT_CONFIG_USER "@DATATEXT_CONFIG_USER@" //Requires FASTFETCH_PROJECT_VERSION and FASTFETCH_DATATEXT_STRUCTURE to be set

src/modules/locale.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ void ffPrintLocale(FFinstance* instance)
4343

4444
//Ubuntu (and deriviates) use a non standard locale file.
4545
//Parse it first, because on distributions where it exists, it takes precedence.
46-
//Otherwise use the standard /etc/locale.conf file.
47-
ffParsePropFile(FASTFETCH_TARGET_DIR_ROOT"/etc/default/locale", "LANG =", &locale);
46+
//Otherwise use the standard etc/locale.conf file.
47+
ffParsePropFile(FASTFETCH_TARGET_DIR_ETC"/default/locale", "LANG =", &locale);
4848

4949
if(locale.length == 0)
5050
{
51-
ffParsePropFile(FASTFETCH_TARGET_DIR_ROOT"/etc/locale.conf", "LANG =", &locale);
51+
ffParsePropFile(FASTFETCH_TARGET_DIR_ETC"/locale.conf", "LANG =", &locale);
5252
}
5353

5454
if(locale.length == 0)

src/modules/packages.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ static void getPackageCounts(const FFinstance* instance, FFstrbuf* baseDir, Pack
379379
ffStrbufSubstrBefore(baseDir, baseDirLength);
380380

381381
//pacman branch
382-
ffStrbufAppendS(baseDir, "/etc/pacman-mirrors.conf");
382+
ffStrbufAppendS(baseDir, FASTFETCH_TARGET_DIR_ETC"/pacman-mirrors.conf");
383383
if(ffParsePropFile(baseDir->chars, "Branch =", &packageCounts->pacmanBranch) && packageCounts->pacmanBranch.length == 0)
384384
ffStrbufAppendS(&packageCounts->pacmanBranch, "stable");
385385
ffStrbufSubstrBefore(baseDir, baseDirLength);
@@ -399,7 +399,7 @@ static void getPackageCounts(const FFinstance* instance, FFstrbuf* baseDir, Pack
399399
ffStrbufAppendS(baseDir, "/var/db/pkg/local.sqlite");
400400
packageCounts->pkg += (uint32_t) ffSettingsGetSQLite3Int(instance, baseDir->chars, "SELECT count(id) FROM packages");
401401
ffStrbufSubstrBefore(baseDir, baseDirLength);
402-
402+
403403
#endif // __FreeBSD__
404404
}
405405

0 commit comments

Comments
 (0)