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

closes #11633
This commit is contained in:
Amr Bashir 2024-11-11 14:58:16 +02:00 committed by GitHub
parent 5e94354875
commit e8a50f6d76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 51 additions and 47 deletions

View File

@ -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.

View File

@ -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 {

View File

@ -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
}
/**