-
Notifications
You must be signed in to change notification settings - Fork 2
/
ImportFileIntoProject.ts
37 lines (34 loc) · 1.01 KB
/
ImportFileIntoProject.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as atomic from "./atomicOperations";
import {File,importIntoProject} from "./../file";
import {getReadableAndWritable} from "./../getAppPath";
export interface ImportFileIntoProjectData
{
opName : "importFileIntoProject";
data : File;
}
export class ImportFileIntoProject extends atomic.AtomicOperation<ImportFileIntoProjectData>
{
public file : File;
constructor(data : ImportFileIntoProjectData)
{
super(data);
this.file = data.data;
this.destinationArtifactsDirectories.push(
getReadableAndWritable(`rt/imported/${this.file.uuid}`)
);
}
public run() : void
{
this.logRecord = atomic.openLog(this.opName,"Import File Into Project");
let self = this;
importIntoProject(this.file!)!.then(() =>
{
self.setSuccess(self.flags);
self.update!();
}).catch((err : Error) =>
{
self.abortOperationWithMessage(err.message);
});
this.update!();
}
}