mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-11-27 20:50:25 +08:00
32 lines
No EOL
881 B
Go
32 lines
No EOL
881 B
Go
// Copyright 2025, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package tsunamiutil
|
|
|
|
import (
|
|
"fmt"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/wavetermdev/waveterm/pkg/wavebase"
|
|
)
|
|
|
|
const DevModeCorsOrigins = "http://localhost:5173,http://localhost:5174"
|
|
|
|
func GetTsunamiAppCachePath(scope string, appName string, osArch string) (string, error) {
|
|
cachesDir := wavebase.GetWaveCachesDir()
|
|
tsunamiCacheDir := filepath.Join(cachesDir, "tsunami-build-cache")
|
|
fullAppName := appName + "." + osArch
|
|
if strings.HasPrefix(osArch, "windows") {
|
|
fullAppName = fullAppName + ".exe"
|
|
}
|
|
fullPath := filepath.Join(tsunamiCacheDir, scope, fullAppName)
|
|
|
|
dirPath := filepath.Dir(fullPath)
|
|
err := wavebase.TryMkdirs(dirPath, 0755, "tsunami cache directory")
|
|
if err != nil {
|
|
return "", fmt.Errorf("failed to create tsunami cache directory: %w", err)
|
|
}
|
|
|
|
return fullPath, nil
|
|
} |