Skip to content

Make script path checks more robust - #102

Open
atollk wants to merge 1 commit into
TitanNano:masterfrom
atollk:disc_100
Open

atollk wants to merge 1 commit into
TitanNano:masterfrom
atollk:disc_100

Conversation

@atollk

@atollk atollk commented Sep 27, 2026

Copy link
Copy Markdown

Following up on #100, this change makes the checks of scripts paths more robust against false negatives, especially allowing symlinks.

@TitanNano TitanNano added the enhancement New feature or request label Oct 6, 2026
@TitanNano

Copy link
Copy Markdown
Owner

Could you please elaborate on what exact problem you are solving with this change? It would also be good if you include some example paths.

@atollk

atollk commented Oct 8, 2026

Copy link
Copy Markdown
Author

Hey. I described the problem it solves in the linked issue. An example path is res://rust_src/scripts, where rust_src is a symlink.

};
let scripts_src_dir = match scripts_src_dir.canonicalize() {
Ok(scripts_src_dir) => scripts_src_dir,
Err(err) => return GString::from(&format!("Unable to validate script location! {}", err.to_string())),
let path_obj = PathBuf::from(ProjectSettings::singleton().globalize_path(&path).to_string());
let path_obj = match path_obj.canonicalize() {
Ok(path_obj) => path_obj,
Err(err) => return GString::from(&format!("Unable to validate script location! {}", err.to_string())),
Comment on lines +20 to +21
use std::ffi::{OsStr, c_void};
use std::path::PathBuf;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep std imports in the first block, separated from external imports by a blank line.

let Some(scripts_src_dir) = self
.scripts_src_dir
.map(|path| ProjectSettings::singleton().localize_path(path))
.map(|path| PathBuf::from(path.to_string()))

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.map(|path| PathBuf::from(path.to_string()))
.map(Path::new)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants