Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): hard code BaseDirectory integer values to avoid regressions when reordering the variants #11645

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/home-dir-regression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri": "patch:bug"
"@tauri-apps/api": "patch:bug"
---

Fix integer values of `BasDirectory.Home` and `BaseDirectory.Font` regression which broke path APIs in JS.
47 changes: 23 additions & 24 deletions crates/tauri/src/path/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,61 +85,60 @@ pub enum BaseDirectory {
/// The Audio directory.
Audio = 1,
/// The Cache directory.
Cache,
Cache = 2,
/// The Config directory.
Config,
Config = 3,
/// The Data directory.
Data,
Data = 4,
/// The LocalData directory.
LocalData,
LocalData = 5,
/// The Document directory.
Document,
Document = 6,
/// The Download directory.
Download,
Download = 7,
/// The Picture directory.
Picture,
Picture = 8,
/// The Public directory.
Public,
Public = 9,
/// The Video directory.
Video,
Video = 10,
/// The Resource directory.
Resource,
Resource = 11,
/// A temporary directory. Resolves to [`std::env::temp_dir`].
Temp,
Temp = 12,
/// The default app config directory.
/// Resolves to [`BaseDirectory::Config`]`/{bundle_identifier}`.
AppConfig,
AppConfig = 13,
/// The default app data directory.
/// Resolves to [`BaseDirectory::Data`]`/{bundle_identifier}`.
AppData,
AppData = 14,
/// The default app local data directory.
/// Resolves to [`BaseDirectory::LocalData`]`/{bundle_identifier}`.
AppLocalData,
AppLocalData = 15,
/// The default app cache directory.
/// Resolves to [`BaseDirectory::Cache`]`/{bundle_identifier}`.
AppCache,
AppCache = 16,
/// The default app log directory.
/// Resolves to [`BaseDirectory::Home`]`/Library/Logs/{bundle_identifier}` on macOS
/// and [`BaseDirectory::Config`]`/{bundle_identifier}/logs` on linux and Windows.
AppLog,
/// The Home directory.
Home,

AppLog = 17,
/// The Desktop directory.
#[cfg(not(target_os = "android"))]
Desktop,
Desktop = 18,
/// The Executable directory.
#[cfg(not(target_os = "android"))]
Executable,
Executable = 19,
/// The Font directory.
#[cfg(not(target_os = "android"))]
Font,
Font = 20,
/// The Home directory.
Home = 21,
/// The Runtime directory.
#[cfg(not(target_os = "android"))]
Runtime,
Runtime = 22,
/// The Template directory.
#[cfg(not(target_os = "android"))]
Template,
Template = 23,
}

impl BaseDirectory {
Expand Down
45 changes: 22 additions & 23 deletions packages/api/src/path.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,28 @@ import { invoke } from './core'
*/
enum BaseDirectory {
Audio = 1,
Cache,
Config,
Data,
LocalData,
Document,
Download,
Picture,
Public,
Video,
Resource,
Temp,
AppConfig,
AppData,
AppLocalData,
AppCache,
AppLog,

Desktop,
Executable,
Font,
Home,
Runtime,
Template
Cache = 2,
Config = 3,
Data = 4,
LocalData = 5,
Document = 6,
Download = 7,
Picture = 8,
Public = 9,
Video = 10,
Resource = 11,
Temp = 12,
AppConfig = 13,
AppData = 14,
AppLocalData = 15,
AppCache = 16,
AppLog = 17,
Desktop = 18,
Executable = 19,
Font = 20,
Home = 21,
Runtime = 22,
Template = 23
}

/**
Expand Down