diff options
author | 2017-03-21 11:49:47 +0100 | |
---|---|---|
committer | 2017-08-15 15:12:42 +0200 | |
commit | 6d5e0dd693e8e7322465323dc8eed4bea1ddce21 (patch) | |
tree | 8a2bcae1988a4a662ea7e552facad2e627923ccb /lib | |
parent | c0fdb912c5e63bb43d6e8dd320e9f5613c6237ff (diff) |
Removing trailing "/" and "\" in directory names only on win32.
This refines e234f3ef. By the way, note that e234f3ef fixed #5391
(command line tools do not accept trailing "/" - or "\" - in windows).
Diffstat (limited to 'lib')
-rw-r--r-- | lib/minisys.ml | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/minisys.ml b/lib/minisys.ml index 1ed017e48..706f0430c 100644 --- a/lib/minisys.ml +++ b/lib/minisys.ml @@ -44,11 +44,13 @@ let ok_dirname f = (* Check directory can be opened *) let exists_dir dir = + (* See BZ#5391 on windows failing on a trailing (back)slash *) let rec strip_trailing_slash dir = let len = String.length dir in if len > 0 && (dir.[len-1] = '/' || dir.[len-1] = '\\') then strip_trailing_slash (String.sub dir 0 (len-1)) else dir in - try Sys.is_directory (strip_trailing_slash dir) with Sys_error _ -> false + let dir = if Sys.os_type = "Win32" then strip_trailing_slash dir else dir in + try Sys.is_directory dir with Sys_error _ -> false let apply_subdir f path name = (* we avoid all files and subdirs starting by '.' (e.g. .svn) *) |