29 lines
1.2 KiB
Ziran
29 lines
1.2 KiB
Ziran
#import, file "../src/platform/launcher_entry.zi";
|
|
#import "c_string"
|
|
#import "text_buffer"
|
|
#import "text"
|
|
#import "vec"
|
|
#import "byte_text_linux"
|
|
c :: #system_library "c";
|
|
Free :: (memory: *u8) #foreign c "free";
|
|
|
|
#program_export
|
|
LauncherEntryBehavior :: () -> s32 {
|
|
if !LauncherAppNameValid("diary") || !LauncherAppNameValid("photos-2") ||
|
|
LauncherAppNameValid("../diary") || LauncherAppNameValid("lumi\nExec=bad") ||
|
|
LauncherAppNameValid("") || LauncherAppNameValid("UPPER") { return 1 }
|
|
out: Vec(u8)
|
|
LauncherExecArgument(*out, "/a b/50%/$`\"\\file")
|
|
quoted := BuilderFinish(out)
|
|
if quoted != "\"/a b/50%%/\\\\$\\\\`\\\\\"\\\\\\\\file\"" { return 2 }
|
|
descriptor := cast(*TextDescriptor)(*quoted)
|
|
Free(descriptor.data)
|
|
entry := LauncherDesktopEntry("/opt/My Apps/inbe", "diary", "日記\nExec=bad",
|
|
"/icons/a\\b.png", "/profiles/one two")
|
|
if !ContainsFoldASCII(entry, "Name=日記\\nExec=bad\nExec=env \"APP_DATA_ROOT=/profiles/one two\"") ||
|
|
!ContainsFoldASCII(entry, "\"/opt/My Apps/inbe\" --app diary\n") ||
|
|
!ContainsFoldASCII(entry, "Icon=/icons/a\\\\b.png\n") ||
|
|
!ContainsFoldASCII(entry, "StartupWMClass=xyz.waozi.inbe.diary") { return 3 }
|
|
return 0
|
|
}
|