mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Check index before returning PlacesPath
This commit is contained in:
parent
1697544cb6
commit
79d35bba5f
1 changed files with 13 additions and 2 deletions
|
|
@ -324,11 +324,22 @@ public class FirefoxBookmarkLoader : FirefoxBookmarkLoaderBase
|
|||
Version=2
|
||||
*/
|
||||
// Seen in the example above, the IsRelative attribute is always above the Path attribute
|
||||
|
||||
var relativePath = Path.Combine(defaultProfileFolderName, "places.sqlite");
|
||||
var absoluePath = Path.Combine(profileFolderPath, relativePath);
|
||||
|
||||
// If the index is out of range, it means that the default profile is in a custom location or the file is malformed
|
||||
// If the profile is in a custom location, we need to check
|
||||
if (indexOfDefaultProfileAttributePath - 1 < 0 ||
|
||||
indexOfDefaultProfileAttributePath - 1 >= lines.Count)
|
||||
{
|
||||
return Directory.Exists(absoluePath) ? absoluePath : relativePath;
|
||||
}
|
||||
|
||||
var relativeAttribute = lines[indexOfDefaultProfileAttributePath - 1];
|
||||
|
||||
return relativeAttribute == "0" // See above, the profile is located in a custom location, path is not relative, so IsRelative=0
|
||||
? defaultProfileFolderName + @"\places.sqlite"
|
||||
: Path.Combine(profileFolderPath, defaultProfileFolderName) + @"\places.sqlite";
|
||||
? relativePath : absoluePath;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue