add PackageFileHandle + support for library definition + minor fix

This commit is contained in:
lxsang
2020-08-04 19:51:32 +02:00
parent b86565212a
commit b1649016f4
6 changed files with 87 additions and 20 deletions

View File

@ -1038,14 +1038,14 @@ namespace OS {
* @returns {void}
* @memberof CodePad
*/
private menuAction(dataid: string, r?: CodePad): void {
let me: any = this;
private menuAction(dataid: string, r?: CodePad): any {
let me: CodePad = this;
if (r) {
me = r;
}
switch (dataid) {
case "new":
return me.openFile("Untitled".asFileHandle());
return me.openFile("Untitled".asFileHandle() as CodePadFileHandle);
case "open":
return me
.openDialog("FileDialog", {
@ -1065,7 +1065,7 @@ namespace OS {
})
.then(function (f: API.FileInfoType) {
me.currdir = f.file.path.asFileHandle();
return me.initSideBar();
return me.toggleSideBar();
});
case "save":
me.currfile.cache = me.editor.getValue();

View File

@ -1,4 +1,5 @@
{
"pkgname": "{0}",
"app":"{0}",
"name":"{0}",
"description":"{0}",

View File

@ -393,7 +393,7 @@ namespace OS {
.then((d: string) => {
let name: string;
const v = JSON.parse(d);
const pth = `${this.installdir}/${v.app}`;
const pth = `${this.installdir}/${v.pkgname?v.pkgname:v.app}`;
const dir = [pth];
const files = [];
for (name in zip.files) {
@ -408,13 +408,13 @@ namespace OS {
return this.mkdirs(dir)
.then(() => {
return this.installFile(
v.app,
v.pkgname?v.pkgname:v.app,
zip,
files
)
.then(() => {
const app_meta = {
pkgname: v.app,
pkgname: v.pkgname?v.pkgname:v.app,
name: v.name,
text: v.name,
icon: v.icon,
@ -430,7 +430,7 @@ namespace OS {
: undefined,
};
v.text = v.name;
v.filename = v.app;
v.filename = v.pkgname?v.pkgname:v.app;
v.type = "app";
v.mime = "antos/app";
if (
@ -442,7 +442,7 @@ namespace OS {
}
v.path = pth;
this.systemsetting.system.packages[
v.app
v.pkgname?v.pkgname:v.app
] = v;
this.appDetail(app_meta);
return resolve(v.name);

View File

@ -6,7 +6,7 @@
"author": "Xuan Sang LE",
"email": "xsang.le@gmail.com"
},
"version":"0.0.1-a",
"version":"0.1.5-a",
"category":"System",
"iconclass":"fa fa-adn",
"mimes":["none"],