Commit 0e5c65d9 authored by wudizhanche1000's avatar wudizhanche1000

去除平台信息的运行

parent c4c69a89
......@@ -2,6 +2,7 @@ import {Component, OnInit} from "@angular/core";
import {AppsService} from "./apps.service";
import {InstallConfig} from "./install-config";
import {SettingsService} from "./settings.sevices";
import {App} from "./app";
declare var process;
declare var $;
......@@ -42,7 +43,7 @@ export class AppDetailComponent implements OnInit {
};
get isInstalled() {
let currentApp=this.appsService.currentApp;
let currentApp = this.appsService.currentApp;
return !!(currentApp.local && currentApp.local.path);
}
......@@ -120,20 +121,20 @@ export class AppDetailComponent implements OnInit {
return dir[0];
}
startApp(app) {
let execute = this.path.join(app.local.path, app.actions[process.platform]["main"].execute);
let args = app.actions[process.platform]["main"].args;
let env = app.actions[process.platform]["main"].env;
startApp(app: App) {
let execute = this.path.join(app.local.path, app.actions.get("main").execute);
let args = app.actions.get("main").args;
let env = app.actions.get("main").env;
let opt = {
cwd: app.local.path,
env: env
};
let open = '';
let openId = app.actions[process.platform]["main"].open;
if (openId) {
let openApp = app.actions.get("main").open;
if (openApp) {
if (this.isInstalled) {
open = this.path.join(this.appsService.searchApp(openId).local.path, this.appsService.searchApp(openId).actions[process.platform]["main"].execute);
open = this.path.join(openApp.local.path, openApp.actions.get("main").execute);
args.push(execute);
} else {
console.error('open app not found');
......
......@@ -29,7 +29,7 @@ export class App {
homepage: string;
category: string;
parent: App;
actions: {[action: string]: {execute: string, args: string[], env: {}, open: App}};
actions: Map<string,{execute: string, args: string[], env: {}, open: App}>;
references: Map<string,App>;
dependencies: Map<string,App>;
locales: string[];
......
......@@ -107,25 +107,26 @@ export class AppsService {
//[{"id": "th01", "wait":["wine", "dx"], resolve: resolve, tarObj: tarObj}]
let waitObj;
let waitRef = ["runtime", "emulator", "dependency"];
if (!this.isEmptyObject(refs)) {
refs[process.platform].map((ref)=> {
if (waitRef.includes(ref.type)) {
if (!this.checkInstall(ref.id)) {
if (!waitObj) {
waitObj = {
id: this.downloadsInfo[index].id,
wait: [ref.id],
resolve: resolve,
tarObj: tarObj
}
} else {
waitObj.wait.push(ref.id);
}
}
}
});
}
// TODO 重写依赖的安装
// let waitRef = ["runtime", "emulator", "dependency"];
// if (!this.isEmptyObject(refs)) {
// refs[process.platform].map((ref)=> {
// if (waitRef.includes(ref.type)) {
// if (!this.checkInstall(ref.id)) {
// if (!waitObj) {
// waitObj = {
// id: this.downloadsInfo[index].id,
// wait: [ref.id],
// resolve: resolve,
// tarObj: tarObj
// }
// } else {
// waitObj.wait.push(ref.id);
// }
// }
// }
// });
// }
console.log("wait obj:", waitObj);
if (waitObj) {
......@@ -138,9 +139,9 @@ export class AppsService {
console.log(tarObj);
this.tarPush(tarObj);
});
promise.catch((err)=> {
console.log("err", err);
})
// promise.catch((err)=> {
// err.printt
// })
}
} else {
console.log("cannot found download info!");
......@@ -249,7 +250,18 @@ export class AppsService {
}
// 设置App关系
for (let id of Array.from(apps.keys())) {
let temp = apps.get(id)["actions"]
let map = new Map<string,any>();
for (let action of Object.keys(temp)) {
let openId = temp[action]["open"];
if (openId) {
temp[action]["open"] = apps.get(openId);
}
map.set(action, temp[action]);
}
apps.get(id).actions = map;
['dependencies', 'references', 'parent'].forEach((key)=> {
let app = apps.get(id);
......@@ -265,6 +277,7 @@ export class AppsService {
}
});
}
console.log(apps);
return apps;
};
......@@ -327,7 +340,7 @@ export class AppsService {
}) !== -1) {
console.log("this app is downloading")
} else {
let url = this.currentApp.download[process.platform];
let url = this.currentApp.download;
this.aria2.addUri([url], {'dir': this.download_dir}, (error, gid)=> {
console.log(error, gid);
if (error) {
......
......@@ -33,7 +33,7 @@
"actions": {
"win32": {
"main": {
"execute": "th07.exe",
"execute": "東方紅魔郷.exe",
"args": [],
"env": {
"LC_ALL": "ja_JP"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment