Skip to content

Commit

Permalink
Merge pull request #137 from unipept/fix/demo-project-on-linux
Browse files Browse the repository at this point in the history
Fix path issue on Linux-based operating systems
  • Loading branch information
pverscha authored May 20, 2021
2 parents 12a2b05 + 41213a9 commit c6d3141
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/logic/filesystem/project/DemoProjectManager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import mkdirp from "mkdirp";
import { promises as fs } from "fs";
import path from "path";

const { app } = require("electron").remote;

import clover1a from "raw-loader!@/demo_project/clover/clover_1a.pep";
Expand All @@ -19,8 +21,7 @@ export default class DemoProjectManager {
*/
public async initializeDemoProject(): Promise<string> {
const tempFolder = app.getPath("temp");
// const tempFolder = "/Users/pverscha/Downloads/Temp/"
const demoFolder = tempFolder + "Demo project/";
const demoFolder = path.join(tempFolder, "Demo project/");

// Create new subdirectory inside of the temp folder
await mkdirp(demoFolder);
Expand All @@ -34,14 +35,14 @@ export default class DemoProjectManager {
await mkdirp(demoFolder + "Clover");

// Now copy all demo files to this directory
await fs.writeFile(demoFolder + "Clover/" + "Clover 1a.pep", clover1a);
await fs.writeFile(demoFolder + "Clover/" + "Clover 1b.pep", clover1b);
await fs.writeFile(demoFolder + "Clover/" + "Clover 2.pep", clover2);
await fs.writeFile(path.join(demoFolder, "Clover", "Clover 1a.pep"), clover1a);
await fs.writeFile(path.join(demoFolder, "Clover", "Clover 1b.pep"), clover1b);
await fs.writeFile(path.join(demoFolder, "Clover", "Clover 2.pep"), clover2);

await mkdirp(demoFolder + "Soybean");

await fs.writeFile(demoFolder + "Soybean/" + "Soybean 1.pep", soybean1);
await fs.writeFile(demoFolder + "Soybean/" + "Soybean 2.pep", soybean2);
await fs.writeFile(path.join(demoFolder, "Soybean", "Soybean 1.pep"), soybean1);
await fs.writeFile(path.join(demoFolder, "Soybean", "Soybean 2.pep"), soybean2);

return demoFolder;
}
Expand Down

0 comments on commit c6d3141

Please sign in to comment.