Repository: tauri-apps/tauri (language: rust)

Issue:
[bug] Tauri 2.1.0 BaseDirectory.Home error
### Describe the bug

```js
const contents = await readTextFile(path, { baseDir: BaseDirectory.Home })
```

macOS
in v2.0.6 is `/Users/myusername/path`
in v2.1.0 is `/Users/myusername/Library/Fonts/path`

[2024-11-09][15:17:20][ERROR][log@http://localhost:5173/node_modules/.vite/deps/@tauri-apps_plugin-log.js:62:20] failed to open file at path: /Users/myusername/Library/Fonts/OneDrive/test.json with error: No such file or directory (os error 2)

### Reproduction

_No response_

### Expected behavior

_No response_

### Full `tauri info` output

```text
[✔] Environment
    - OS: Mac OS 15.1.0 arm64 (X64)
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.82.0 (f6e511eec 2024-10-15)
    ✔ cargo: 1.82.0 (8f40fc59f 2024-08-21)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-aarch64-apple-darwin (default)
    - node: 23.1.0
    - npm: 10.9.0
    - bun: 1.1.34

[-] Packages
    - tauri 🦀: 2.1.0
    - tauri-build 🦀: 2.0.3
    - wry 🦀: 0.47.0
    - tao 🦀: 0.30.6
    - tauri-cli 🦀: 1.6.1
    - @tauri-apps/api : 2.1.0
    - @tauri-apps/cli : 2.1.0

[-] Plugins
    - tauri-plugin-deep-link 🦀: 2.0.1
    - @tauri-apps/plugin-deep-link : 2.0.0
    - tauri-plugin-single-instance 🦀: 2.0.1
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-dialog 🦀: 2.0.3
    - @tauri-apps/plugin-dialog : 2.0.1
    - tauri-plugin-fs 🦀: 2.0.3
    - @tauri-apps/plugin-fs : 2.0.2
    - tauri-plugin-store 🦀: 2.1.0
    - @tauri-apps/plugin-store : 2.1.0
    - tauri-plugin-log 🦀: 2.0.2
    - @tauri-apps/plugin-log : 2.0.0
    - tauri-plugin-shell 🦀: 2.0.2
    - @tauri-apps/plugin-shell : 2.0.1
    - tauri-plugin-autostart 🦀: 2.0.1
    - @tauri-apps/plugin-autostart : 2.0.0
    - tauri-plugin-os 🦀: 2.0.1
    - @tauri-apps/plugin-os : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../build
    - devUrl: http://localhost:5173/
    - framework: Svelte
    - bundler: Vite
```


### Stack trace

_No response_

### Additional context

_No response_


Discussion / hints:
Please include the output of the `tauri info` command as required by the issue template.
> Please include the output of the `tauri info` command as required by the issue template.

Updated.

Fix patch:
diff --git a/.changes/home-dir-regression.md b/.changes/home-dir-regression.md
new file mode 100644
index 000000000000..4f2de5531e93
--- /dev/null
+++ b/.changes/home-dir-regression.md
@@ -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.
diff --git a/crates/tauri/src/path/mod.rs b/crates/tauri/src/path/mod.rs
index 28854fb547ff..575fa926bfd6 100644
--- a/crates/tauri/src/path/mod.rs
+++ b/crates/tauri/src/path/mod.rs
@@ -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 {
diff --git a/packages/api/src/path.ts b/packages/api/src/path.ts
index dd81affd49eb..9e8e5e034756 100644
--- a/packages/api/src/path.ts
+++ b/packages/api/src/path.ts
@@ -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
 }
 
 /**


Test patch: