Skip to content
This repository has been archived by the owner on Dec 20, 2021. It is now read-only.

Use filepath instead of path for Windows support #1098

Merged
merged 3 commits into from
Mar 24, 2021

Conversation

willroberts
Copy link
Contributor

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.

drpaneas
drpaneas previously approved these changes Mar 24, 2021
Copy link
Contributor

@drpaneas drpaneas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Copy link
Contributor

@drpaneas drpaneas left a 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 ;)

d2core/d2hero/hero_state_factory.go Outdated Show resolved Hide resolved
Comment on lines -204 to +203
return os.Open(path.Join(mpqDir, mpqName)) //nolint:gosec // Will fix later
return os.Open(filepath.Join(mpqDir, mpqName)) //nolint:gosec // Will fix later
Copy link
Contributor

@gucio321 gucio321 Mar 24, 2021

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"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol good catch

@essial essial merged commit 236a091 into OpenDiablo2:master Mar 24, 2021
@willroberts willroberts deleted the windows-path-support branch March 24, 2021 13:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants