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

Commit

Permalink
MacOS setup process finalized
Browse files Browse the repository at this point in the history
  • Loading branch information
rer145 committed Apr 10, 2020
1 parent 2a55265 commit 67a79f7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 42 deletions.
10 changes: 6 additions & 4 deletions assets/js/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ function sudo(command, options, error_callback, result_callback) {
);
}

function exec(file, parameters, error_callback, result_callback, ismac) {
function exec(file, parameters, error_callback, result_callback, unquoteFile) {
//this should do a UAC prompt
//let cmd = 'cmd.exe /c "' + file + '"';
let cmd = '"' + file + '"';
if (unquoteFile != undefined && unquoteFile) {
cmd = file;
}

$.each(parameters, function(i,v) {
cmd = cmd + ' "' + v + '"';
});

if (ismac != undefined && ismac) {
cmd = file;
}


console.warn("Executing [" + cmd + "]");

Expand Down
4 changes: 2 additions & 2 deletions assets/js/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ function install_rportable() {
source_root = path.join(store.get("app.resources_path"), "R-Portable", "R-Portable-Mac");
}

batch_file = 'cp -a ' + source_root + '/. ' + dest_root + '/';
batch_file = 'cp -a "' + source_root + '/." "' + dest_root + '/"';
}

if (is.windows || is.macos) {
Expand Down Expand Up @@ -197,7 +197,7 @@ function install_packages() {
}
);

batch_file = store.get("app.rscript_path") + ' ' + path.join(store.get("app.r_analysis_path"), "install.R") + ' ' + store.get("user.packages_path");
batch_file = '"' + store.get("app.rscript_path") + '" "' + path.join(store.get("app.r_analysis_path"), "install.R") + '" "' + store.get("user.packages_path") + '"';
params = [];
}

Expand Down
44 changes: 8 additions & 36 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,16 @@ function prep_files_and_settings() {
make_directory(userPackagesPath);
make_directory(userAnalysisPath);

// TODO: check if packages path is empty and set firstRun = true

if (fs.readdirSync(userPackagesPath).length == 0)
firstRun = true;

if (is.macos) {
make_directory(path.join(userDataPath, "R-Portable"));

let RPortable = path.join(userDataPath, "R-Portable");
make_directory(RPortable);

if (fs.readdirSync(RPortable).length == 0)
firstRun = true;

RPortablePath = path.join(
userDataPath,
"R-Portable",
Expand Down Expand Up @@ -291,38 +295,6 @@ function prep_files_and_settings() {
}
};
store.set(settings);

// // check if packages path is empty, if so, consider it the first run
// fs.readdirSync(userPackagesPath, function(err, files) {
// console.log("checking for packages", err, files);
// if (!err) {
// if (!files.length) {
// store.set("settings.first_run", true);
// }
// }
// });

// var r_path = path.join(__dirname, "assets/r");
// copy_file(
// path.join(r_path, "mamd.csv"),
// path.join(analysis_path, "mamd.csv"),
// true);
// copy_file(
// path.join(r_path, "Geo.Origin.csv"),
// path.join(analysis_path, "Geo.Origin.csv"),
// true);
// copy_file(
// path.join(r_path, "mamd.R"),
// path.join(analysis_path, "mamd.R"),
// true);
// copy_file(
// path.join(r_path, "install_package.R"),
// path.join(analysis_path, "install_package.R"),
// true);
// copy_file(
// path.join(r_path, "verify_package.R"),
// path.join(analysis_path, "verify_package.R"),
// true);
};


Expand Down

0 comments on commit 67a79f7

Please sign in to comment.