Skip to content

Commit

Permalink
refactor(core): remove BaseDirectory::Current variant
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jan 26, 2022
1 parent c80e8b6 commit 696dca5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .changes/remove-current-base-directory.md
@@ -0,0 +1,6 @@
---
"tauri": patch
"api": patch
---

Remove the `BaseDirectory::Current` enum variant for security reasons.
2 changes: 1 addition & 1 deletion core/tauri/scripts/bundle.js

Large diffs are not rendered by default.

10 changes: 1 addition & 9 deletions core/tauri/src/api/path.rs
Expand Up @@ -4,10 +4,7 @@

//! Types and functions related to file system path operations.

use std::{
env,
path::{Component, Path, PathBuf},
};
use std::path::{Component, Path, PathBuf};

use crate::{Config, Env, PackageInfo};

Expand Down Expand Up @@ -60,8 +57,6 @@ pub enum BaseDirectory {
/// The default App config directory.
/// Resolves to [`BaseDirectory::Config`].
App,
/// The current working directory.
Current,
/// The Log directory.
/// Resolves to [`BaseDirectory::Home/Library/Logs/{bundle_identifier}`] on macOS
/// and [`BaseDirectory::Config/{bundle_identifier}/logs`] on linux and windows.
Expand Down Expand Up @@ -90,7 +85,6 @@ impl BaseDirectory {
Self::Video => "$VIDEO",
Self::Resource => "$RESOURCE",
Self::App => "$APP",
Self::Current => "$CWD",
Self::Log => "$LOG",
}
}
Expand All @@ -116,7 +110,6 @@ impl BaseDirectory {
"$VIDEO" => Self::Video,
"$RESOURCE" => Self::Resource,
"$APP" => Self::App,
"$CWD" => Self::Current,
"$LOG" => Self::Log,
_ => return None,
};
Expand Down Expand Up @@ -206,7 +199,6 @@ pub fn resolve_path<P: AsRef<Path>>(
BaseDirectory::Video => video_dir(),
BaseDirectory::Resource => resource_dir(package_info, env),
BaseDirectory::App => app_dir(config),
BaseDirectory::Current => Some(env::current_dir()?),
BaseDirectory::Log => log_dir(config),
};
if let Some(mut base_dir_path_value) = base_dir_path {
Expand Down
1 change: 0 additions & 1 deletion tooling/api/src/fs.ts
Expand Up @@ -52,7 +52,6 @@ export enum BaseDirectory {
Video,
Resource,
App,
Current,
Log
}

Expand Down

0 comments on commit 696dca5

Please sign in to comment.