Skip to content

Commit 7925469

Browse files
committed
DE (Linux): detect COSMIC version
1 parent 53116d6 commit 7925469

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/detection/de/de_linux.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,21 @@ static const char* getTrinity(FFstrbuf* result, FFDEOptions* options)
234234
return "All methods failed";
235235
}
236236

237+
static const char* getCosmic(FFstrbuf* result, FF_MAYBE_UNUSED FFDEOptions* options)
238+
{
239+
if (ffProcessAppendStdOut(result, (char* const[]){
240+
"cosmic-comp",
241+
"--version",
242+
NULL
243+
}) == NULL) {
244+
// cosmic-comp 0.1.0 (git commit fa88002ba41d2edec25dd7ffdee9719fbb928fc0)
245+
ffStrbufSubstrBeforeLastC(result, ' ');
246+
ffStrbufSubstrAfterFirstC(result, ' ');
247+
return NULL;
248+
}
249+
250+
return "All methods failed";
251+
}
237252

238253
const char* ffDetectDEVersion(const FFstrbuf* deName, FFstrbuf* result, FFDEOptions* options)
239254
{
@@ -257,6 +272,8 @@ const char* ffDetectDEVersion(const FFstrbuf* deName, FFstrbuf* result, FFDEOpti
257272
getUnity(result, options);
258273
else if (ffStrbufEqualS(deName, "trinity"))
259274
getTrinity(result, options);
275+
else if (ffStrbufEqualS(deName, "COSMIC"))
276+
getCosmic(result, options);
260277
else
261278
return "Unsupported DE";
262279
return NULL;

0 commit comments

Comments
 (0)