mirror of
https://github.com/vrc-get/vrc-get.git
synced 2026-06-21 09:58:08 +00:00
Compare commits
2 commits
master
...
copilot/ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c77feedb9 |
||
|
|
86ff13c3c8 |
4 changed files with 29 additions and 0 deletions
|
|
@ -480,6 +480,20 @@ pub async fn project_open_unity(
|
|||
return Ok(false);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let project_path_ref = Path::new(project_path.as_str());
|
||||
let check_dirs = ["Assets", "Packages", "Library"];
|
||||
let is_noexec = check_dirs
|
||||
.iter()
|
||||
.map(|dir| project_path_ref.join(dir))
|
||||
.filter(|p| p.exists())
|
||||
.any(|p| crate::os::is_noexec(&p));
|
||||
if is_noexec {
|
||||
return Err(localizable_error!("projects:error:noexec mount point"));
|
||||
}
|
||||
}
|
||||
|
||||
let mut custom_args: Option<Vec<String>> = None;
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,6 +88,13 @@ pub fn initialize(app_handle: tauri::AppHandle) {
|
|||
APPDIR.store(app_handle.env().appdir.clone().map(Arc::from));
|
||||
}
|
||||
|
||||
pub(crate) fn is_noexec(path: &std::path::Path) -> bool {
|
||||
match nix::sys::statvfs::statvfs(path) {
|
||||
Ok(stat) => stat.flags().contains(nix::sys::statvfs::FsFlags::ST_NOEXEC),
|
||||
Err(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open_that(path: impl AsRef<OsStr>) -> io::Result<()> {
|
||||
// We implement open_that here since we have to fix env variables for xdg-open.
|
||||
// This implementation supports xdg-open only but it's general enough for most cases, I think
|
||||
|
|
|
|||
|
|
@ -195,6 +195,13 @@ pub fn initialize(_: tauri::AppHandle) {
|
|||
// nothing to initialize
|
||||
}
|
||||
|
||||
pub(crate) fn is_noexec(path: &std::path::Path) -> bool {
|
||||
match nix::sys::statfs::statfs(path) {
|
||||
Ok(stat) => stat.flags().contains(nix::sys::statfs::MntFlags::MNT_NOEXEC),
|
||||
Err(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn fix_env_variables(_: &mut Command) {
|
||||
// nothing to do
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,3 +52,4 @@ pub fn os_info() -> &'static str {
|
|||
|
||||
pub use os_more::initialize;
|
||||
pub use os_more::open_that;
|
||||
pub use os_more::is_noexec;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue