-
-
Notifications
You must be signed in to change notification settings - Fork 615
Fix relative paths support for Python/Node.js executables #4230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
438bb8a
d61ec18
864eedd
3de9e53
ab5a0b4
c59249d
9070ff4
d16e43d
d49e5b4
9fa4c37
001101b
34a984c
b923c40
9b0a503
d62fd05
04a56b5
57fde0a
bfed516
f756b71
8e6d718
c9c306f
8b6f9f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,5 +42,36 @@ | |
| public const string PluginEnvironments = "Environments"; | ||
| public const string PluginDeleteFile = "NeedDelete.txt"; | ||
| public static readonly string PluginEnvironmentsPath = Path.Combine(DataDirectory(), PluginEnvironments); | ||
|
|
||
| /// <summary> | ||
| /// Resolves a path that may be relative to an absolute path. | ||
| /// If the path is already absolute, returns it as-is. | ||
| /// If the path is not rooted (as determined by <see cref="Path.IsPathRooted(string)"/>), resolves it relative to ProgramDirectory. | ||
| /// </summary> | ||
| /// <param name="path">The path to resolve</param> | ||
| /// <returns>An absolute path</returns> | ||
| public static string ResolveAbsolutePath(string path) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method probably will get used more and more, is it worth putting it in the Plugin project under FilesFolders class? This project already has access to that project's classes right?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Good idea! Changed as requested. |
||
| { | ||
| if (string.IsNullOrEmpty(path)) | ||
| return path; | ||
|
|
||
| // If already absolute, return as-is | ||
| if (Path.IsPathRooted(path)) | ||
|
Jack251970 marked this conversation as resolved.
Outdated
|
||
| return path; | ||
|
|
||
| // Resolve relative to ProgramDirectory, handling invalid path formats gracefully | ||
| try | ||
| { | ||
| return Path.GetFullPath(Path.Combine(Constant.ProgramDirectory, path)); | ||
| } | ||
| catch (Exception ex) when (ex is ArgumentException || | ||
|
Check failure on line 67 in Flow.Launcher.Infrastructure/UserSettings/DataLocation.cs
|
||
| ex is NotSupportedException || | ||
| ex is PathTooLongException) | ||
| { | ||
| // If the path cannot be resolved (invalid characters, format, or too long), | ||
| // return the original path to avoid crashing the application. | ||
| return path; | ||
| } | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.