mumax / 3

GPU-accelerated micromagnetic simulator
Other
447 stars 150 forks source link

mumax3-convert incorrect output directory format in windows #253

Closed Axialum closed 4 years ago

Axialum commented 4 years ago

Mumax3-convert output directory flag doesn't correctly handle the differences in windows vs linux directory path separators.

An example: mumax-convert.exe -png -o png_file_dir original_file_dir/m000000.ovf

Tries to place the output file in (which fails): png_file_dir/original_file_dir\m000000.png

I believe this is because at line 136 in cmd/mumax3-convert/main.go the filepath.Glob returns the directory structure matching the current OS style while line 167 assumes '/' format and also uses the old path.Base command rather than the new filepath.Base.

Filepath accounts for OS, path assumes linux style and so doesn't correctly remove the old parent directory.

The concatenation of files should use filepath.Join() rather than simple string concatenation.

Hopefully this is a simple fix if the file writing also correctly handles the differences in OS formats, but would need to be validated on both linux and windows.

JeroenMulkers commented 4 years ago

Fixed in 11780481

Thank you for this detailed explanation!