Skip to content

Commit e4ab218

Browse files
committed
fix(data): fix data directory errors and log display issues
1 parent 4c76f31 commit e4ab218

File tree

4 files changed

+863
-890
lines changed

4 files changed

+863
-890
lines changed

.github/workflows/build-test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,18 +225,17 @@ jobs:
225225
226226
- name: Build the app
227227
if: matrix.platform == 'windows' || matrix.platform == 'linux'
228-
run: |
229-
yarn build --target ${{ matrix.target }}
228+
uses: tauri-apps/tauri-action@v0
230229
env:
231230
NODE_OPTIONS: "--max_old_space_size=4096"
232231
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
233232
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
233+
with:
234+
args: --target ${{ matrix.target }}
234235

235236
- name: Build the app (macOS)
237+
uses: tauri-apps/tauri-action@v0
236238
if: matrix.platform == 'macos'
237-
run: |
238-
export TAURI_SKIP_SIDECAR_SIGNATURE_CHECK=true
239-
yarn build --target ${{ matrix.target }}
240239
env:
241240
NODE_OPTIONS: "--max_old_space_size=4096"
242241
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
@@ -248,6 +247,9 @@ jobs:
248247
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
249248
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
250249
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
250+
TAURI_SKIP_SIDECAR_SIGNATURE_CHECK: "true"
251+
with:
252+
args: --target ${{ matrix.target }}
251253

252254
- name: Upload artifacts
253255
uses: actions/upload-artifact@v4

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@
9898
"tar": "^7.4.3",
9999
"typescript": "^5.8.3",
100100
"typescript-eslint": "^8.41.0",
101-
"vite": "^7.1.3",
101+
"vite": "^7.1.11",
102102
"vue-eslint-parser": "^10.2.0",
103103
"vue-tsc": "^3.0.6"
104+
},
105+
"overrides": {
106+
"tmp": "^0.2.4"
104107
}
105108
}

src-tauri/src/utils/path.rs

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,31 @@ use std::{env, fs};
33

44
pub static APP_ID: &str = "io.github.openlistteam.openlist.desktop";
55

6+
// Normalize path without Windows long path prefix (\\?\)
7+
// The \\?\ prefix breaks compatibility with some applications like SQLite
8+
fn normalize_path(path: &PathBuf) -> Result<PathBuf, String> {
9+
#[cfg(target_os = "windows")]
10+
{
11+
// On Windows, use canonicalize but strip the \\?\ prefix if present
12+
let canonical = path
13+
.canonicalize()
14+
.map_err(|e| format!("Failed to canonicalize path: {e}"))?;
15+
16+
let path_str = canonical.to_string_lossy();
17+
if let Some(stripped) = path_str.strip_prefix(r"\\?\") {
18+
Ok(PathBuf::from(stripped))
19+
} else {
20+
Ok(canonical)
21+
}
22+
}
23+
24+
#[cfg(not(target_os = "windows"))]
25+
{
26+
path.canonicalize()
27+
.map_err(|e| format!("Failed to canonicalize path: {e}"))
28+
}
29+
}
30+
631
fn get_app_dir() -> Result<PathBuf, String> {
732
let app_dir = env::current_exe()
833
.map_err(|e| format!("Failed to get current exe path: {e}"))?
@@ -46,9 +71,7 @@ fn get_user_data_dir() -> Result<PathBuf, String> {
4671

4772
fs::create_dir_all(&data_dir).map_err(|e| format!("Failed to create data directory: {e}"))?;
4873

49-
data_dir
50-
.canonicalize()
51-
.map_err(|e| format!("Failed to canonicalize data directory: {e}"))
74+
normalize_path(&data_dir)
5275
}
5376

5477
fn get_user_logs_dir() -> Result<PathBuf, String> {
@@ -69,9 +92,7 @@ fn get_user_logs_dir() -> Result<PathBuf, String> {
6992
};
7093

7194
fs::create_dir_all(&logs_dir).map_err(|e| format!("Failed to create logs directory: {e}"))?;
72-
logs_dir
73-
.canonicalize()
74-
.map_err(|e| format!("Failed to canonicalize logs directory: {e}"))
95+
normalize_path(&logs_dir)
7596
}
7697

7798
fn get_binary_path(binary: &str, service_name: &str) -> Result<PathBuf, String> {
@@ -123,16 +144,14 @@ pub fn get_service_log_path() -> Result<PathBuf, String> {
123144
let home = env::var("HOME").map_err(|_| "Failed to get HOME environment variable")?;
124145
let logs = PathBuf::from(home)
125146
.join("Library")
126-
.join("Application Support")
127-
.join("io.github.openlistteam.openlist.service.bundle")
128-
.join("Contents")
129-
.join("MacOS")
147+
.join("Logs")
148+
.join("OpenList Desktop")
130149
.join("openlist-desktop-service.log");
131150
Ok(logs)
132151
}
133152

134153
#[cfg(not(target_os = "macos"))]
135154
{
136-
Ok(get_user_data_dir()?.join("openlist-desktop-service.log"))
155+
Ok(get_app_logs_dir()?.join("openlist-desktop-service.log"))
137156
}
138157
}

0 commit comments

Comments
 (0)