Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Fix bug?
Browse files Browse the repository at this point in the history
  • Loading branch information
jhm-ciberman committed Mar 7, 2018
1 parent 150abf1 commit 3ed4e85
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/generator/ScriptLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class ScriptLoader implements IScriptLoader {
if (!gmScript.match(config.pattern)) {
return [];
}
const pathStr = path.normalize(path.resolve(gmProject.path, gmScript.filepath));
const pathStr = path.resolve(gmProject.path, gmScript.filepath);
let str;
try {
str = await fse.readFile(pathStr, "utf8");
Expand Down
2 changes: 1 addition & 1 deletion src/gm_project/gms1/GMS1ProjectLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default class GMS1ProjectLoader implements IGMProjectLoader {
}

for (const script of folderData.script || []) {
const resource = new GMS1Script(script);
const resource = new GMS1Script(script.replace(/\\/g, "/"));
root.addChild(resource);
}
return root;
Expand Down
2 changes: 1 addition & 1 deletion src/gm_project/gms1/GMS1Script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class GMS1Script extends GMResource implements IGMScript {
*/
constructor(file: string) {
super(path.basename(file).split(".")[0]);
this.filepath = path.normalize(file);
this.filepath = file;
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/gm_project/gms2/GMS2ProjectLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export default class GMS2ProjectLoader implements IGMProjectLoader {
* @returns A Promise with the created GMS2Project
*/
public async load(projectFile: string): Promise<IGMProject> {
projectFile = path.normalize(projectFile);
projectFile = this._normalize(projectFile);
const projectFolder = path.dirname(projectFile);
const factory = new GMS2ProjectFactory(projectFolder);

const data: IProject = await fse.readJson(projectFile);

for (const item of data.resources) {
const resourceJsonFile = path.normalize(path.resolve(projectFolder, item.Value.resourcePath));
const resourceJsonFile = this._normalize(path.resolve(projectFolder, item.Value.resourcePath));
const resourceData: IResource = await fse.readJson(resourceJsonFile);
this._createFromData(factory, item.Key, resourceData);
}
Expand All @@ -50,4 +50,8 @@ export default class GMS2ProjectLoader implements IGMProjectLoader {
}
}

private _normalize(p: string): string {
return path.normalize(p.replace(/\\/g, "/"));
}

}

0 comments on commit 3ed4e85

Please sign in to comment.