Astrabit-ST / Luminol

An RPG Maker XP-VX Ace rewrite, written in Rust with love 💕
https://luminol.dev/
GNU General Public License v3.0
104 stars 13 forks source link

[BUG] Error locating destination directory for project #149

Open LordPatate opened 3 months ago

LordPatate commented 3 months ago

Describe the bug

Creating a new project fails on Windows with message : "Error locating destination directory for project". I suspect the problem to be simply an UNIX-style path for the .luminol/config file instead of a platform-agnostic path.

Trying to re-open the project will fail.

To Reproduce

Steps to reproduce the behavior:

  1. Click "New Project"
  2. (Probably optional) Rename project
  3. (Probably optional) Enable "Initialize a git repository"
  4. (Probably optional) Rename default branch to "main"
  5. Select an empty folder
  6. Click OK

Backtrace

2024-08-14T16:46:11.822772Z ERROR luminol_core: Luminol error:
   0: Error locating destination directory for project
   1: While writing .luminol/config
   2: While opening file "G:\\LuminolProjects\\.luminol/config" in a host folder
   3: The system cannot find the path specified. (os error 3)

Location:
   D:\a\Luminol\Luminol\crates\filesystem\src\native.rs:118

Luminol version: 1140aa2

image

When I tried re-opening the project:

2024-08-14T16:47:21.650137Z ERROR luminol_core: Luminol error:
   0: Error opening the project
   1: While loading project data
   2: While loading project configuration
   3: Unable to detect the project's RPG Maker version (perhaps you did not open an RPG Maker project?

Location:
   crates\filesystem\src\project.rs:163

Luminol version: 1140aa2

Expected behavior

Creating a new project without errors :)

Desktop

Additional context

Just grabbed the windows build from the latest autobuild deployment pipeline.

I'm a developer, I'll try to take a look, see if I can find the problem and open a PR for it.

Speak2Erase commented 3 months ago

Does opening an existing project work?

Speak2Erase commented 3 months ago

It'll take me a bit to get to testing this because I run Linux and booting into Windows is a hassle, but I'll take a look into this

LordPatate commented 3 months ago

Does opening an existing project work?

I have no idea, I don't think I'm able to check since I don't have any existing project on my computer.

LordPatate commented 3 months ago

I found 8 results for a hardcoded string ".luminol/config" which is probably not the right way to join paths in Rust, right? image I see that the path.join(path) method exists on several occurrences. I'm guessing that's how Luminol got the first part of the path right? (G:\\LuminolProjects\\.luminol/config)

        let path = self.root_path.join(path.as_ref());
Speak2Erase commented 3 months ago

The problem is a but more complicated than that- Luminol has an internal filesystem that's supposed to accept paths that either contain / or \ (or a mix of both) and that seems to be breaking. Windows actually can handle / paths, but it still hands out \ whenever querying what's inside a folder.

Speak2Erase commented 3 months ago

Interesting, opening a pre-existing project works just fine (even one without the .luminol folder)

LordPatate commented 3 months ago

Interesting, opening a pre-existing project works just fine (even one without the .luminol folder)

What if you try to save the pre-existing project that did not have .luminol folder? I suspect it will try to write the .luminol/config at save time.

Speak2Erase commented 3 months ago

Interesting, opening a pre-existing project works just fine (even one without the .luminol folder)

What if you try to save the pre-existing project that did not have .luminol folder? I suspect it will try to write the .luminol/config at save time.

It actually writes when opening a project without the config file present. This is because the editor has to guess the script path, which will tweak the project, and we'd rather guess the script path only once