feat: The runtime supports offline mode. (#10481)

This commit is contained in:
CityFun 2025-09-25 15:26:59 +08:00 committed by wanghe-fit2cloud
parent 4e061ebcb4
commit 2f02157689
2 changed files with 8 additions and 2 deletions

View file

@ -43,11 +43,17 @@ type App struct {
func (i *App) IsLocalApp() bool { func (i *App) IsLocalApp() bool {
return i.Resource == constant.ResourceLocal return i.Resource == constant.ResourceLocal
} }
func (i *App) IsCustomApp() bool {
return i.Resource == constant.AppResourceCustom
}
func (i *App) GetAppResourcePath() string { func (i *App) GetAppResourcePath() string {
if i.IsLocalApp() { if i.IsLocalApp() {
//这里要去掉本地应用的local前缀
return filepath.Join(global.Dir.LocalAppResourceDir, strings.TrimPrefix(i.Key, "local")) return filepath.Join(global.Dir.LocalAppResourceDir, strings.TrimPrefix(i.Key, "local"))
} }
if i.IsCustomApp() {
return filepath.Join(global.Dir.CustomAppResourceDir, i.Key)
}
return filepath.Join(global.Dir.RemoteAppResourceDir, i.Key) return filepath.Join(global.Dir.RemoteAppResourceDir, i.Key)
} }

View file

@ -946,7 +946,7 @@ func handleMap(params map[string]interface{}, envParams map[string]string) {
} }
func downloadApp(app model.App, appDetail model.AppDetail, appInstall *model.AppInstall, logger *log.Logger) (err error) { func downloadApp(app model.App, appDetail model.AppDetail, appInstall *model.AppInstall, logger *log.Logger) (err error) {
if app.IsLocalApp() { if app.IsLocalApp() || app.IsCustomApp() {
return nil return nil
} }
appResourceDir := path.Join(global.Dir.AppResourceDir, app.Resource) appResourceDir := path.Join(global.Dir.AppResourceDir, app.Resource)