c3lang / c3c

Compiler for the C3 language
GNU Lesser General Public License v3.0
1.34k stars 80 forks source link

`std::io::path` - `.` is not a directory #1169

Closed ghost closed 2 months ago

ghost commented 3 months ago

On linux-x64, p.str_view() returns blank, path::is_dir(p) returns false.

import std::io;

fn void! main(String[] argv)
{
    Path! p = path::new(".");
    if (catch p)
    {
        io::eprintn("path::new() failed.");
        return;
    }
    io::printfn("'%s' is a directory: %s.", p.str_view(), path::is_dir(p));
}
lerno commented 3 months ago

I need to do some research on how to best make this work correct on both Win and Posix

lerno commented 3 months ago

What is the desired behaviour? If we think about things like appending and defining such a path. Should there be an "empty path"("") as well as "current path" (".")?

lerno commented 2 months ago

This should be fixed in dev now.

unereal commented 2 months ago

it works