Skip to content

Commit 2e1ddcf

Browse files
OverflowCatCarterLiCopilot
authored
Logo (Builtin): Add HarmonyOS support (#1804)
* Logo (Builtin): add HarmonyOS * OS (HarmonyOS): detect HarmonyOS * Update src/detection/os/os_linux.c Co-authored-by: Copilot <[email protected]> * Update os_linux.c --------- Co-authored-by: Carter Li <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent f1cc2d1 commit 2e1ddcf

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed

src/detection/os/os_linux.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,19 @@ static void detectOS(FFOSResult* os)
304304
parseOsRelease(FASTFETCH_TARGET_DIR_ETC "/os-release", os);
305305
if (os->id.length == 0 || os->version.length == 0 || os->prettyName.length == 0 || os->codename.length == 0)
306306
parseLsbRelease(FASTFETCH_TARGET_DIR_ETC "/lsb-release", os);
307-
if (os->id.length == 0 || os->name.length > 0 || os->prettyName.length > 0)
307+
if (os->id.length == 0 || os->name.length == 0 || os->prettyName.length == 0)
308308
parseOsRelease(FASTFETCH_TARGET_DIR_USR "/lib/os-release", os);
309+
if (os->id.length == 0 && os->name.length == 0 && os->prettyName.length == 0)
310+
{
311+
// HarmonyOS has no os-release file
312+
if (ffStrbufEqualS(&instance.state.platform.sysinfo.name, "HarmonyOS"))
313+
{
314+
ffStrbufSetS(&os->id, "harmonyos");
315+
ffStrbufSetS(&os->idLike, "harmonyos");
316+
ffStrbufSetS(&os->name, "HarmonyOS");
317+
ffStrbufSetS(&os->prettyName, "HarmonyOS");
318+
}
319+
}
309320
}
310321

311322
void ffDetectOSImpl(FFOSResult* os)

src/logo/ascii/harmonyos.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
....-----....
2+
.-+##############+-..
3+
.+######################+..
4+
.########+- -++#######-.
5+
.+######- -######+.
6+
.######. .######..
7+
.+####+ +#####..
8+
.-####+. +####+.
9+
.+####+ -####+..
10+
..+####+ -####+...
11+
$2......--$1+####+$2--.......................--$1+####+$2-.........
12+
..$1--++++-$2...... ...$1-++++--$2..
13+
..$1--+++--$2... ...$1-+++++-$2..
14+
.$1--+++--$2.... ....$1--+++-$2...
15+
..$1-++++++--$2..... ......$1---+---$2...
16+
...$1-+++++++++-----$2..$1----++++++--$2..
17+
...$1---++++++----++++++++---$2...
18+
.....$1-----+++-----$2...
19+
...$1---$2...

src/logo/builtin.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,17 @@ static const FFlogo H[] = {
21862186
.colorKeys = FF_COLOR_FG_RED,
21872187
.colorTitle = FF_COLOR_FG_RED,
21882188
},
2189+
// HarmonyOS
2190+
{
2191+
.names = {"HarmonyOS"},
2192+
.lines = FASTFETCH_DATATEXT_LOGO_HARMONYOS,
2193+
.colors = {
2194+
FF_COLOR_FG_WHITE,
2195+
FF_COLOR_FG_BLUE,
2196+
},
2197+
.colorKeys = FF_COLOR_FG_BLUE,
2198+
.colorTitle = FF_COLOR_FG_BLUE,
2199+
},
21892200
// Hash
21902201
{
21912202
.names = {"Hash"},

0 commit comments

Comments
 (0)