diff --git a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs index dead5f293..37a1449c1 100644 --- a/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs +++ b/Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs @@ -73,8 +73,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments if (!string.IsNullOrEmpty(selectedFile)) { - // Convert to relative path if within ProgramDirectory for portability - PluginsSettingsFilePath = DataLocation.ConvertToRelativePathIfPossible(selectedFile); + PluginsSettingsFilePath = selectedFile; } // Nothing selected because user pressed cancel from the file dialog window else @@ -98,8 +97,7 @@ namespace Flow.Launcher.Core.ExternalPlugins.Environments if (!string.IsNullOrEmpty(selectedFile)) { - // Convert to relative path if within ProgramDirectory for portability - PluginsSettingsFilePath = DataLocation.ConvertToRelativePathIfPossible(selectedFile); + PluginsSettingsFilePath = selectedFile; } else { diff --git a/Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs b/Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs index 4588a9e6a..2e23734d7 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs @@ -62,46 +62,5 @@ namespace Flow.Launcher.Infrastructure.UserSettings // Resolve relative to ProgramDirectory return Path.GetFullPath(Path.Combine(Constant.ProgramDirectory, path)); } - - /// - /// Converts an absolute path to a relative path if it's within ProgramDirectory. - /// This enables portability by storing paths relative to the program directory when possible. - /// - /// The absolute path to convert - /// A relative path if the path is within ProgramDirectory, otherwise the original absolute path - public static string ConvertToRelativePathIfPossible(string absolutePath) - { - if (string.IsNullOrEmpty(absolutePath)) - return absolutePath; - - if (!Path.IsPathRooted(absolutePath)) - return absolutePath; - - try - { - // Get the full absolute paths for comparison - var fullAbsolutePath = Path.GetFullPath(absolutePath); - var fullProgramDir = Path.GetFullPath(Constant.ProgramDirectory); - - // Check if the absolute path is within ProgramDirectory - if (fullAbsolutePath.StartsWith(fullProgramDir, StringComparison.OrdinalIgnoreCase)) - { - // Convert to relative path - var relativePath = Path.GetRelativePath(fullProgramDir, fullAbsolutePath); - - // Prefix with .\ for clarity - if (!relativePath.StartsWith('.')) - relativePath = ".\\" + relativePath; - - return relativePath; - } - } - catch - { - // If conversion fails, return the original path - } - - return absolutePath; - } } }