Commit 0e5c65d9 authored by wudizhanche1000's avatar wudizhanche1000

去除平台信息的运行

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