-
-
Notifications
You must be signed in to change notification settings - Fork 104
Fixes tmpdir & AppImage writing issues #741
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
base: develop
Are you sure you want to change the base?
Conversation
caesay
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this PR! There are a few things that can be simplified, if you don't get around to it I can fix and merge later.
| // Ensure the copied runtime is writable before appending squashfs. | ||
| try { | ||
| if (VelopackRuntimeInfo.IsLinux) { | ||
| #if NET8_0_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think any of this code that calls SetUnixFileMode is necessary. ChmodFileAsExecutable already sets 755, is that not sufficient?
| tempDir = "/tmp/velopack"; | ||
| } else if (VelopackRuntimeInfo.IsWindows) { | ||
| tempDir = Path.Combine(Path.GetTempPath(), "Velopack"); | ||
| var velopackTemp = Environment.GetEnvironmentVariable("VELOPACK_TEMP"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason why VELOPACK_TEMP isn't treated the same as the other environment variables? We could simplify this code significantly:
var envTempDir = new[] { "VELOPACK_TEMP", "TMPDIR", "TEMP", "TMP" }
.Select(Environment.GetEnvironmentVariable)
.FirstOrDefault(x => x != null);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
|
|
||
| if (Options.PackDirectory.EndsWith(".AppDir", StringComparison.OrdinalIgnoreCase)) { | ||
| var packDirName = Options.PackDirectory?.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); | ||
| var packDirBase = string.IsNullOrWhiteSpace(packDirName) ? Options.PackDirectory : packDirName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I understand this line of code. If the goal is to allow trailing slashes then the TrimEnd would've been the only thing we needed to add and I think we have a guarantee here already that Options.PackDirectory is not null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--packDir is sensitive to path-to/foo.AppDir/ and vpk will only operate if the parameter is path-to/foo.AppDir, however using tab autocomplete the trailing / is added, requiring to manually edit the command.
Will use TrimEnd.
This should fix #738 and #739