wren-lang / wren-cli

A command line tool for the Wren programming language
MIT License
129 stars 31 forks source link

Trouble with modules #53

Open petelomax opened 3 years ago

petelomax commented 3 years ago

I've just downloaded wren (hi!), but I can't get any modules to load:

Could not load module 'E:\E:/downloads/misc/wren/wren_cli-windows-0.3.0/pattern'.

Where I'm using import "/pattern" for Pattern and the pattern.wren off rosettacode. It does not matter where I put it, it ain't ever getting past that "E:\E:/" (as proved with procmon). Running on windows 10

Pete

mhermier commented 3 years ago

Currently, modules are loaded from a "wren_modules" directory from the first parent directory, relative to PWD or script path (I don't remember exactly).

petelomax commented 3 years ago

Yep, already tried that. If I change the first line to import "pattern" for Pattern, and create \wren_modules\pattern\pattern.wren (just in case), it still fails this time just saying Could not load module 'pattern'. and procmon identifies the actual error as:

E:\E:\downloads\misc\wren\wren_cli-windows-0.3.0\wren_modules\pattern\pattern.wren

I also tried import "\\pattern" for Pattern, and the error just goes back to "E:\E:/".

mhermier commented 3 years ago

I don't have windows to test it easily, it might be there is a problem in path somehow seeing that the drive is duplicated.

petelomax commented 3 years ago

Ah! It works when in the same directory, but not elsewhere.

In other words if pwd yields E:\downloads\misc\wren\wren_cli-windows-0.3.0 and I run wren_cli-0.3.0.exe test.wren, but not for E:\downloads\misc\wren\wren_cli-windows-0.3.0\wren_cli-0.3.0.exe E:\downloads\misc\wren\wren_cli-windows-0.3.0\test.wren

In fact the latter command does not work even when I am in the right directory.

mhermier commented 3 years ago

Probably a platform issue, windows has an odd notion of pwd of execution...

petelomax commented 3 years ago

OK, this is now the lowest possible priority, but next time you get a chance, it really shouldn't mangle path names like that. Cheers.

ruby0x1 commented 3 years ago

As this is a CLI issue, it has been moved to the CLI repo.

joshgoebel commented 3 years ago

@petelomax Can you confirm you still have an issue on the latest code? (we just bumped to 0.4.0)

petelomax commented 3 years ago

Sorry, there is no release as yet for me to test at https://github.com/wren-lang/wren-cli/releases The latest build there is still from June 5th 2020 (I'm a bit backward that way!)