Closed github-actions[bot] closed 1 year ago
Alright, this is what is happening on Windows OS:
As you may know, Windows uses
\
to separate directories and Unix uses/
. So, what is happening here:Yep, it's mixing
\
with/
. So, I think it may be the current error.
- from this comment
More detailed what is happening here. (The problem isn't on this library itself), look:
I created a file called paths.art
with this code:
Look what happens when I run it:
So, look at lines 1750 and 1797.
Arturo is using the function item.split(DirSep))
, split
is a nim's standard function from strutils.nim
module, none problem here, and DirSep
that also is a nim's standard function comes from osseps.nim
module, none problem here too.
But, let's see what DirSep
returns for windows systems:
DirSep* =
when defined(macos): ':'
elif doslikeFileSystem or defined(vxworks): '\\'
elif defined(RISCOS): '.'
else: '/'
## The character used by the operating system to separate pathname
## components, for example: `'/'` for POSIX, `':'` for the classic
## Macintosh, and `'\\'` on Windows.
Yes, it'll split using a \
. As Arturo's module
function is returning with bot separators, it won't work. It'll separate just until user's path, and then a big string.
It's a issue related with module
function.
Also, I must say. At the same ossep.nim
module, exists an AltSep
for windows systems:
AltSep* =
when doslikeFileSystem: '/'
else: DirSep
## An alternative character used by the operating system to separate
## pathname components, or the same as `DirSep <#DirSep>`_ if only one separator
## character exists. This is set to `'/'` on Windows systems
## where `DirSep <#DirSep>`_ is a backslash (`'\\'`).
[Collections/split] Is
.path
working correctly?example:
debug split.path "directory/wofilerld"
This should return an array containing
directory
andwofilerld
, which exactly how it works for me (on macOS), but there could be issues with other OSes?https://github.com/arturo-lang/arturo/blob/1136d74ff6685ec5b16c64021b3cf1a0dfc45fa8/src/library/Collections.nim#L1704
387a336a63f3eb63994641cb3d81b8953e459d68