Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows - Dome Fails to load files from other Drives #257

Open
whmsft opened this issue Mar 8, 2023 · 3 comments
Open

Windows - Dome Fails to load files from other Drives #257

whmsft opened this issue Mar 8, 2023 · 3 comments
Labels
bug Something isn't working windows Related to the Windows platform

Comments

@whmsft
Copy link

whmsft commented Mar 8, 2023

Description

By doing anything to load any file (either FileSystem or AudioEngine) from another drive (say, the program is in E: drive and I want stuff from C: drive), or even the same drive (with full path, not relative to main.wren)

Result

A Runtime error as thus:

Runtime error: Could not find file: <filename>

Expected behavior

The File/Music/Image to load

Minimal Reproducible Example

import "io" for FileSystem
import "audio" for AudioEngine

class main {
    construct new() {}
    init() {
		// with FileSystem
        FileSystem.load("C:/files/from_0_to_ONE.txt") // Fails
        FileSystem.load("/C/files/from_0_to_ONE.txt") // Fails
		
		// with AudioEngine
		AudioEngine.load("C:/audio/all_falls_down.mp3") // Fails
		AudioEngine.load("/C/audio/all_falls_down.mp3") // Fails

		// what works is only relative paths
		FileSystem.load("./../../file_on_same_drive.txt") // Works
    }
	update() {}
	draw() {}
}

var Game = main.new()

Specs:

Dome Version: v1.8.0.1 - ffc441e
OS: Windows (bear it) 7 Basic
Hardware: Lenovo (bear it, again) G460 (2 months older than me)

@catsanddo
Copy link
Contributor

Interestingly, if you use this path instead: "//./C:/files/from_0_to_ONE.txt", it seems to work just fine. I'm not very familiar with the windows file system, so I don't really have any idea what this actually means.

It seems like the underlying call is just a simple fopen which should be able to open strings in the style of "C:/files/from_0_to_ONE.txt" (I tested this myself). It just doesn't seem to work inside of dome for some reason. There must be something that I overlooked in my admittedly cursory review of the code involved.

@avivbeeri
Copy link
Collaborator

DOME uses this to resolve paths:

dome/src/io.c

Line 84 in a5c8286

resolvePath(const char* partialPath, bool* shouldFree) {

DOME does expect Unix-style paths, but the MSYS2 runtime should handle that fine. Windows makes it weird.

I am interested in pulling out some of the path handling code and replacing it with this: https://github.com/likle/cwalk

@whmsft
Copy link
Author

whmsft commented May 21, 2023

@catsanddo You're right! "//./C:/files/from_0_to_ONE.txt" surprisingly works.

@avivbeeri avivbeeri added bug Something isn't working windows Related to the Windows platform labels Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Related to the Windows platform
Projects
None yet
Development

No branches or pull requests

3 participants