Skip to content

Commit 5b8f9de

Browse files
committed
project: rename Unix reference such as CF_UNIX to Linux
I have never tested customfetch in freebsd or any OS that doesn't use the linux kernel, so I may not know if the queries will work as indeed. also I now have changed from `#error` to `#warning` in platform.hpp, so I don't have to force users to not compile customfetch on any Unix OS
1 parent 94ed0fa commit 5b8f9de

22 files changed

+97
-62
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ include_directories(include)
1212
file(GLOB
1313
SRC
1414
"src/*.cpp"
15-
"src/query/unix/*.cpp"
15+
"src/query/linux/*.cpp"
1616
"src/query/android/*.cpp"
17-
"src/query/unix/utils/*.cpp"
17+
"src/query/linux/utils/*.cpp"
1818
"src/toml++/toml.cpp")
1919

2020
add_executable(customfetch ${SRC})

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ TARGET = $(NAME)
5353
OLDVERSION = 0.10.1
5454
VERSION = 0.10.2
5555
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
56-
SRC = $(wildcard src/*.cpp src/query/unix/*.cpp src/query/android/*.cpp src/query/unix/utils/*.cpp)
56+
SRC = $(wildcard src/*.cpp src/query/linux/*.cpp src/query/android/*.cpp src/query/linux/utils/*.cpp)
5757
OBJ = $(SRC:.cpp=.o)
5858
LDFLAGS += -L./$(BUILDDIR)/fmt -lfmt -ldl
5959
CXXFLAGS ?= -mtune=generic -march=native

android/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ include_directories(${CMAKE_SOURCE_DIR}/../include)
1111
file(GLOB
1212
SRC
1313
"${CMAKE_SOURCE_DIR}/../src/*.cpp"
14-
"${CMAKE_SOURCE_DIR}/../src/query/unix/*.cpp"
14+
"${CMAKE_SOURCE_DIR}/../src/query/linux/*.cpp"
1515
"${CMAKE_SOURCE_DIR}/../src/query/android/*.cpp"
16-
"${CMAKE_SOURCE_DIR}/../src/query/unix/utils/*.cpp"
16+
"${CMAKE_SOURCE_DIR}/../src/query/linux/utils/*.cpp"
1717
"${CMAKE_SOURCE_DIR}/../src/toml++/toml.cpp"
1818
"app/src/main/cpp/customfetch_android.cpp"
1919
)

include/platform.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
# define CF_ANDROID 0
88
#endif
99

10-
#if (defined(unix) || defined(__unix) || defined(__unix__)) && !CF_ANDROID
11-
# define CF_UNIX 1
10+
#if (defined(__linux) || defined(__linux__) || defined(__gnu_linux__)) && !CF_ANDROID
11+
# define CF_LINUX 1
1212
#else
13-
# define CF_UNIX 0
13+
# define CF_LINUX 0
1414
#endif
1515

1616
#if (defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__))
@@ -19,8 +19,8 @@
1919
# define CF_WINDOWS 0
2020
#endif
2121

22-
#if !(CF_UNIX || CF_ANDROID) || CF_WINDOWS
23-
# error "Platform currently not supported, only Unix and Android"
22+
#if !(CF_LINUX || CF_ANDROID) || CF_WINDOWS
23+
# warning "Platform currently may not be supported, only Linux and Android"
2424
#endif
2525

2626
#endif // _PLATFORM_H

po/customfetch.pot

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -240,81 +240,81 @@ msgstr ""
240240
msgid "Failed to find $HOME, set it to your home directory!"
241241
msgstr ""
242242

243-
#: src/query/unix/cpu.cpp:282
243+
#: src/query/linux/cpu.cpp:282
244244
#, c++-format
245245
msgid "Could not open {}"
246246
msgstr ""
247247

248-
#: src/query/unix/disk.cpp:62
248+
#: src/query/linux/disk.cpp:62
249249
msgid "setmntent"
250250
msgstr ""
251251

252-
#: src/query/unix/disk.cpp:63
252+
#: src/query/linux/disk.cpp:63
253253
msgid "setmntent() failed. Could not get disk info"
254254
msgstr ""
255255

256-
#: src/query/unix/disk.cpp:85
256+
#: src/query/linux/disk.cpp:85
257257
msgid "Failed to get disk info"
258258
msgstr ""
259259

260-
#: src/query/unix/gpu.cpp:104
260+
#: src/query/linux/gpu.cpp:104
261261
msgid "Failed to parse GPU infos on the path /sys/class/drm/"
262262
msgstr ""
263263

264-
#: src/query/unix/ram.cpp:59
264+
#: src/query/linux/ram.cpp:59
265265
#, c++-format
266266
msgid ""
267267
"Could not open {}\n"
268268
"Failed to get RAM infos"
269269
msgstr ""
270270

271-
#: src/query/unix/system.cpp:98
271+
#: src/query/linux/system.cpp:98
272272
msgid "Failed to get OS infos"
273273
msgstr ""
274274

275-
#: src/query/unix/system.cpp:172
275+
#: src/query/linux/system.cpp:172
276276
#, c++-format
277277
msgid ""
278278
"uname() failed: {}\n"
279279
"Could not get system infos"
280280
msgstr ""
281281

282-
#: src/query/unix/system.cpp:175
282+
#: src/query/linux/system.cpp:175
283283
#, c++-format
284284
msgid ""
285285
"sysinfo() failed: {}\n"
286286
"Could not get system infos"
287287
msgstr ""
288288

289-
#: src/query/unix/system.cpp:236
289+
#: src/query/linux/system.cpp:236
290290
msgid "/proc/1/comm doesn't exist! (what?)"
291291
msgstr ""
292292

293-
#: src/query/unix/theme.cpp:179 src/query/unix/theme.cpp:381
293+
#: src/query/linux/theme.cpp:179 src/query/linux/theme.cpp:381
294294
msgid ""
295295
"customfetch could not detect a gtk configuration file. customfetch will use "
296296
"the much-slower gsettings."
297297
msgstr ""
298298

299-
#: src/query/unix/theme.cpp:180 src/query/unix/theme.cpp:382
299+
#: src/query/linux/theme.cpp:180 src/query/linux/theme.cpp:382
300300
msgid ""
301301
"If there's a file in a standard location that we aren't detecting, please "
302302
"file an issue on our GitHub."
303303
msgstr ""
304304

305-
#: src/query/unix/theme.cpp:383
305+
#: src/query/linux/theme.cpp:383
306306
msgid ""
307307
"You can disable this warning by disabling slow-query-warnings in your "
308308
"config.toml file."
309309
msgstr ""
310310

311-
#: src/query/unix/user.cpp:331
311+
#: src/query/linux/user.cpp:331
312312
#, c++-format
313313
msgid ""
314314
"getpwent failed: {}\n"
315315
"Could not get user infos"
316316
msgstr ""
317317

318-
#: src/query/unix/utils/dewm.cpp:201
318+
#: src/query/linux/utils/dewm.cpp:201
319319
msgid "Root node <mate-version> not found"
320320
msgstr ""

po/it_IT.po

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -262,81 +262,81 @@ msgstr ""
262262
msgid "Failed to find $HOME, set it to your home directory!"
263263
msgstr ""
264264

265-
#: src/query/unix/cpu.cpp:282
265+
#: src/query/linux/cpu.cpp:282
266266
#, c++-format
267267
msgid "Could not open {}"
268268
msgstr ""
269269

270-
#: src/query/unix/disk.cpp:62
270+
#: src/query/linux/disk.cpp:62
271271
msgid "setmntent"
272272
msgstr ""
273273

274-
#: src/query/unix/disk.cpp:63
274+
#: src/query/linux/disk.cpp:63
275275
msgid "setmntent() failed. Could not get disk info"
276276
msgstr ""
277277

278-
#: src/query/unix/disk.cpp:85
278+
#: src/query/linux/disk.cpp:85
279279
msgid "Failed to get disk info"
280280
msgstr ""
281281

282-
#: src/query/unix/gpu.cpp:104
282+
#: src/query/linux/gpu.cpp:104
283283
msgid "Failed to parse GPU infos on the path /sys/class/drm/"
284284
msgstr ""
285285

286-
#: src/query/unix/ram.cpp:59
286+
#: src/query/linux/ram.cpp:59
287287
#, c++-format
288288
msgid ""
289289
"Could not open {}\n"
290290
"Failed to get RAM infos"
291291
msgstr ""
292292

293-
#: src/query/unix/system.cpp:98
293+
#: src/query/linux/system.cpp:98
294294
msgid "Failed to get OS infos"
295295
msgstr ""
296296

297-
#: src/query/unix/system.cpp:172
297+
#: src/query/linux/system.cpp:172
298298
#, c++-format
299299
msgid ""
300300
"uname() failed: {}\n"
301301
"Could not get system infos"
302302
msgstr ""
303303

304-
#: src/query/unix/system.cpp:175
304+
#: src/query/linux/system.cpp:175
305305
#, c++-format
306306
msgid ""
307307
"sysinfo() failed: {}\n"
308308
"Could not get system infos"
309309
msgstr ""
310310

311-
#: src/query/unix/system.cpp:236
311+
#: src/query/linux/system.cpp:236
312312
msgid "/proc/1/comm doesn't exist! (what?)"
313313
msgstr ""
314314

315-
#: src/query/unix/theme.cpp:179 src/query/unix/theme.cpp:381
315+
#: src/query/linux/theme.cpp:179 src/query/linux/theme.cpp:381
316316
msgid ""
317317
"customfetch could not detect a gtk configuration file. customfetch will use "
318318
"the much-slower gsettings."
319319
msgstr ""
320320

321-
#: src/query/unix/theme.cpp:180 src/query/unix/theme.cpp:382
321+
#: src/query/linux/theme.cpp:180 src/query/linux/theme.cpp:382
322322
msgid ""
323323
"If there's a file in a standard location that we aren't detecting, please "
324324
"file an issue on our GitHub."
325325
msgstr ""
326326

327-
#: src/query/unix/theme.cpp:383
327+
#: src/query/linux/theme.cpp:383
328328
msgid ""
329329
"You can disable this warning by disabling slow-query-warnings in your "
330330
"config.toml file."
331331
msgstr ""
332332

333-
#: src/query/unix/user.cpp:331
333+
#: src/query/linux/user.cpp:331
334334
#, c++-format
335335
msgid ""
336336
"getpwent failed: {}\n"
337337
"Could not get user infos"
338338
msgstr ""
339339

340-
#: src/query/unix/utils/dewm.cpp:201
340+
#: src/query/linux/utils/dewm.cpp:201
341341
msgid "Root node <mate-version> not found"
342342
msgstr ""

scripts/make_pot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ xgettext \
1010
--package-version="$(awk -F '= ' '/^VERSION/ {print $2}' Makefile | sed 's/\"//g')" \
1111
-k_ \
1212
-o po/customfetch.pot \
13-
src/*.cpp src/query/android/*.cpp src/query/unix/*.cpp src/query/unix/utils/*.cpp --c++
13+
src/*.cpp src/query/android/*.cpp src/query/linux/*.cpp src/query/linux/utils/*.cpp --c++

src/query/android/system.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <array>
3333
#include <string_view>
3434

35-
#include "../unix/utils/packages.hpp"
35+
#include "../linux/utils/packages.hpp"
3636
#include "query.hpp"
3737
#include "util.hpp"
3838

@@ -48,11 +48,11 @@ static System::System_t get_system_infos()
4848
ret.os_version_codename = get_android_property("ro.build.version.codename");
4949
ret.os_pretty_name = "Android " + ret.os_version_codename + " " + ret.os_version_id;
5050

51-
constexpr std::array<std::string_view, 8> properties_name = {
51+
constexpr std::array<std::string_view, 8> vendors_prop_names = {
5252
"ro.product.marketname", "ro.vendor.product.display", "ro.config.devicename", "ro.config.marketing_name",
5353
"ro.product.vendor.model", "ro.product.oppo_model", "ro.oppo.market.name", "ro.product.brand"
5454
};
55-
for (const std::string_view name : properties_name)
55+
for (const std::string_view name : vendors_prop_names)
5656
{
5757
if (ret.host_modelname.empty() || ret.host_modelname == UNKNOWN)
5858
ret.host_modelname = get_android_property(name);

src/query/unix/battery.cpp renamed to src/query/linux/battery.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525

2626
#include "platform.hpp"
27-
#if CF_UNIX
27+
#if CF_LINUX
2828

2929
#include <cstdlib>
3030
#include <string>
@@ -134,4 +134,4 @@ double& Battery::perc() noexcept
134134
double& Battery::temp() noexcept
135135
{ return m_battery_infos.temp; }
136136

137-
#endif // CF_UNIX
137+
#endif // CF_LINUX

src/query/unix/cpu.cpp renamed to src/query/linux/cpu.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
*
2424
*/
2525

26+
#include "platform.hpp"
27+
#if CF_ANDROID || CF_LINUX
28+
2629
#include <sys/types.h>
2730

2831
#include <array>
@@ -33,7 +36,6 @@
3336
#include <string_view>
3437

3538
#include "fmt/format.h"
36-
#include "platform.hpp"
3739
#include "query.hpp"
3840
#include "switch_fnv1a.hpp"
3941
#include "util.hpp"
@@ -262,7 +264,7 @@ static std::string detect_exynos(const std::string& model_name)
262264

263265
return model_name;
264266
}
265-
#endif
267+
#endif // CF_ANDROID
266268

267269
static std::string get_from_text(std::string& line)
268270
{
@@ -470,3 +472,5 @@ double& CPU::temp() noexcept
470472

471473
return m_cpu_infos.temp;
472474
}
475+
476+
#endif // CF_ANDROID || CF_LINUX

0 commit comments

Comments
 (0)