openplanet-nl / issues

Issue tracker for Openplanet.
10 stars 0 forks source link

`Net::HttpRequest().SaveToFile()` doesn't save file when there are mixed slashes in file path. #565

Closed CodyNinja1 closed 1 month ago

CodyNinja1 commented 1 month ago

e.g. when calling request.SaveToFile("C:/Users/user/Documents/Maniaplanet\\Packs\\file.txt") the file downloaded from the request doesn't save

CodyNinja1 commented 1 month ago

the source of the mixed slashes usually comes from the fact that the IO::From functions return absolute paths with backslashes instead of forwardslashes

codecat commented 1 month ago

I can't reproduce this. This works fine for me:

void Main()
{
    auto req = Net::HttpGet("https://example.org/");
    while (!req.Finished()) {
        yield();
    }

    string path = IO::FromStorageFolder("test/foo.txt");
    req.SaveToFile(path);
    print("Done: " + path);
}

image

image

Note that I had to make the test folder myself first. Is that maybe the problem you're running into?

CodyNinja1 commented 1 month ago

In my use case, which is downloading packs into the Packs folder, the Packs folder in Documents/Maniaplanet/Packs/ always exists. Might be a wine/proton related issue since I am running maniaplanet on steam via proton?

codecat commented 1 month ago

That's definitely possible. I don't have a Linux machine to test this right now, unfortunately.

CodyNinja1 commented 1 month ago

I do have a windows machine, I will test this shortly.

CodyNinja1 commented 1 month ago

Sorry I got a bit sidetracked and forgot to report what happened on windows, the issue for me seems to be non-existent there.