Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 移动端导入大于 32M 的 Data 包失败 https://github.com/siyuan-note/siyuan/issues/5067

Liang Ding6e24e483d691
diff --git a/kernel/util/working.go b/kernel/util/working.go
index 14a90718c7..c4df4430eb 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -250,6 +250,14 @@ func initWorkspaceDir(workspaceArg string) {
ConfDir = filepath.Join(WorkspaceDir, "conf")
DataDir = filepath.Join(WorkspaceDir, "data")
TempDir = filepath.Join(WorkspaceDir, "temp")
+ osTmpDir := filepath.Join(TempDir, "os")
+ os.RemoveAll(osTmpDir)
+ if err := os.MkdirAll(osTmpDir, 0755); nil != err {
+ log.Fatalf("create os tmp dir [%s] failed: %s", osTmpDir, err)
+ }
+ os.Setenv("TMPDIR", osTmpDir)
+ os.Setenv("TEMP", osTmpDir)
+ os.Setenv("TMP", osTmpDir)
DBPath = filepath.Join(TempDir, DBName)
BlockTreePath = filepath.Join(TempDir, "blocktree.msgpack")
}
diff --git a/kernel/util/working_mobile.go b/kernel/util/working_mobile.go
index bdc4895f33..fc3d399d32 100644
--- a/kernel/util/working_mobile.go
+++ b/kernel/util/working_mobile.go
@@ -18,6 +18,7 @@ package util
import (
"math/rand"
+ "os"
"path/filepath"
"time"
@@ -35,6 +36,10 @@ func BootMobile(container, appDir, workspaceDir, nativeLibDir, privateDataDir, l
ConfDir = filepath.Join(workspaceDir, "conf")
DataDir = filepath.Join(workspaceDir, "data")
TempDir = filepath.Join(workspaceDir, "temp")
+ osTmpDir := filepath.Join(TempDir, "os")
+ os.RemoveAll(osTmpDir)
+ os.MkdirAll(osTmpDir, 0755)
+ os.Setenv("TMPDIR", osTmpDir)
DBPath = filepath.Join(TempDir, DBName)
BlockTreePath = filepath.Join(TempDir, "blocktree.msgpack")
AndroidNativeLibDir = nativeLibDir