Skip to content

Commit

Permalink
create os compatible script to run app
Browse files Browse the repository at this point in the history
  • Loading branch information
faizanvahevaria committed Apr 3, 2020
1 parent 28e0ea5 commit f4acd51
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ var fs = require('fs');
var path = require('path');
const title = require('./package.json').title;
const description = require('./package.json').description;
const baseDirName = require('./package.json').name;
let vDialog = null;
var forEach = require('async-foreach').forEach;
var dElement = require('./src/diagram/dElement');
Expand Down Expand Up @@ -561,13 +562,25 @@ function init() {
app.project.on('projectLoaded', initProject);
}
function runStarUML(){
let src = 'D:/Faizan-Vahevaria/StarUML/new-cloned/staruml-cefact/';
let dest = 'C:/Users/Mayur/AppData/Roaming/StarUML/extensions/user/gs-gs.staruml-cefact/';
/* possible values of os 'aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', 'win32' */
let homeDirectory = os.homedir();
let dest = '';
let src = __dirname+path.sep;
if(os.platform == 'win32') {
dest = homeDirectory+path.sep+'AppData'+path.sep+'Roaming'+path.sep+'StarUML'+path.sep+'extensions'+path.sep+'user'+path.sep+baseDirName+path.sep;
}
else if(os.platform == 'linux') {
dest = homeDirectory+'.config'+path.sep+'StarUML'+path.sep+'extensions'+path.sep+'user'+path.sep+baseDirName+path.sep;
}
console.log("platform : ",os.platform);
console.log("base : ",baseDirName);
console.log("src : ",src);
console.log("dest : ",dest);
console.log("Coping files..!")
fsNew.copy(src, dest)
.then(() => console.log('success!'))
.catch(err => console.error(err))
.catch(err => console.error(err));
return '';
}
}
exports.init = init
exports.runStarUML = runStarUML

0 comments on commit f4acd51

Please sign in to comment.