From 6e24e483d691055d10ef4507a6bb7c69dc93d463 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 1 Jun 2022 17:19:31 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=A4=A7=E4=BA=8E=2032M=20=E7=9A=84=20Data=20?= =?UTF-8?q?=E5=8C=85=E5=A4=B1=E8=B4=A5=20https://github.com/siyuan-note/si?= =?UTF-8?q?yuan/issues/5067?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/util/working.go | 8 ++++++++ kernel/util/working_mobile.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/kernel/util/working.go b/kernel/util/working.go index 14a90718c..c4df4430e 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 bdc4895f3..fc3d399d3 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