-
-
Notifications
You must be signed in to change notification settings - Fork 808
Use filepath instead of path for Windows support #1098
Conversation
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.
/lgtm
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.
See my comment, you need to change the syntax a bit ;)
return os.Open(path.Join(mpqDir, mpqName)) //nolint:gosec // Will fix later | ||
return os.Open(filepath.Join(mpqDir, mpqName)) //nolint:gosec // Will fix later |
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.
could you also fix this nolint directive; This "Will fix later" is there from very long time 😀 : https://stackoverflow.com/questions/52320708/how-to-handle-gosec-linter-warning-potential-file-inclusion-via-variable
@@ -72,7 +72,7 @@ type Credits struct { | |||
|
|||
// LoadContributors loads the contributors data from file | |||
func (v *Credits) LoadContributors() []string { | |||
file, err := os.Open(path.Join("./", "CONTRIBUTORS")) | |||
file, err := os.Open(filepath.Join(".", "CONTRIBUTORS")) |
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.
Lol good catch
The current build fails to create the
OpenDiablo2
directory on Windows without this change.In contrast to
path
,path/filepath
is OS-aware and handles Windows path separators correctly.