Desktop file ID or empty string if file does not have an ID.
1 string[] appPaths; 2 string filePath, nestedFilePath, wrongFilePath; 3 4 version(Windows) { 5 appPaths = [`C:\ProgramData\KDE\share\applications`, `C:\Users\username\.kde\share\applications`]; 6 filePath = `C:\ProgramData\KDE\share\applications\example.desktop`; 7 nestedFilePath = `C:\ProgramData\KDE\share\applications\kde\example.desktop`; 8 wrongFilePath = `C:\ProgramData\desktop\example.desktop`; 9 } else { 10 appPaths = ["/usr/share/applications", "/usr/local/share/applications"]; 11 filePath = "/usr/share/applications/example.desktop"; 12 nestedFilePath = "/usr/share/applications/kde/example.desktop"; 13 wrongFilePath = "/etc/desktop/example.desktop"; 14 } 15 16 assert(desktopId(nestedFilePath, appPaths) == "kde-example.desktop"); 17 assert(desktopId(filePath, appPaths) == "example.desktop"); 18 assert(desktopId(wrongFilePath, appPaths).empty); 19 assert(desktopId("", appPaths).empty);
desktopfile.paths.applicationsPaths
See Desktop File ID