Skip to content

Commit

Permalink
GetDrive: Make it work on Macintosh
Browse files Browse the repository at this point in the history
The function returns the volume name on MacOSX and that can be a multi-letter string.

Bug present since at least c143784 (MIES_Utilities.ipf: Factor out
windows drive parsing into GetDrive, 2021-01-21).
  • Loading branch information
t-b committed Nov 14, 2023
1 parent 1c22671 commit bed07f3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Packages/MIES/MIES_Utilities.ipf
Original file line number Diff line number Diff line change
Expand Up @@ -1795,14 +1795,13 @@ Function IsDriveValid(absPath)
return FolderExists(drive)
End

/// @brief Return the windows drive letter of the given path
/// @brief Return the drive letter of the given path (Windows) or the volume name (Macintosh)
Function/S GetDrive(string path)

string drive

path = GetHFSPath(path)
drive = StringFromList(0, path, ":")
ASSERT(strlen(drive) == 1, "Expected a single letter for the drive")

return drive
end
Expand Down

0 comments on commit bed07f3

Please sign in to comment.