Skip to content

Commit 696dca5

Browse files
committed
refactor(core): remove BaseDirectory::Current variant
1 parent c80e8b6 commit 696dca5

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": patch
3+
"api": patch
4+
---
5+
6+
Remove the `BaseDirectory::Current` enum variant for security reasons.

core/tauri/scripts/bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/tauri/src/api/path.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
//! Types and functions related to file system path operations.
66
7-
use std::{
8-
env,
9-
path::{Component, Path, PathBuf},
10-
};
7+
use std::path::{Component, Path, PathBuf};
118

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

@@ -60,8 +57,6 @@ pub enum BaseDirectory {
6057
/// The default App config directory.
6158
/// Resolves to [`BaseDirectory::Config`].
6259
App,
63-
/// The current working directory.
64-
Current,
6560
/// The Log directory.
6661
/// Resolves to [`BaseDirectory::Home/Library/Logs/{bundle_identifier}`] on macOS
6762
/// and [`BaseDirectory::Config/{bundle_identifier}/logs`] on linux and windows.
@@ -90,7 +85,6 @@ impl BaseDirectory {
9085
Self::Video => "$VIDEO",
9186
Self::Resource => "$RESOURCE",
9287
Self::App => "$APP",
93-
Self::Current => "$CWD",
9488
Self::Log => "$LOG",
9589
}
9690
}
@@ -116,7 +110,6 @@ impl BaseDirectory {
116110
"$VIDEO" => Self::Video,
117111
"$RESOURCE" => Self::Resource,
118112
"$APP" => Self::App,
119-
"$CWD" => Self::Current,
120113
"$LOG" => Self::Log,
121114
_ => return None,
122115
};
@@ -206,7 +199,6 @@ pub fn resolve_path<P: AsRef<Path>>(
206199
BaseDirectory::Video => video_dir(),
207200
BaseDirectory::Resource => resource_dir(package_info, env),
208201
BaseDirectory::App => app_dir(config),
209-
BaseDirectory::Current => Some(env::current_dir()?),
210202
BaseDirectory::Log => log_dir(config),
211203
};
212204
if let Some(mut base_dir_path_value) = base_dir_path {

tooling/api/src/fs.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export enum BaseDirectory {
5252
Video,
5353
Resource,
5454
App,
55-
Current,
5655
Log
5756
}
5857

0 commit comments

Comments
 (0)