no message
This commit is contained in:
52
src/_VisualDVM/Passes/All/LocalInitaliseUser.java
Normal file
52
src/_VisualDVM/Passes/All/LocalInitaliseUser.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Utils.Utils_;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Utils;
|
||||
import _VisualDVM.GlobalData.User.User;
|
||||
import _VisualDVM.GlobalData.User.UserState;
|
||||
import _VisualDVM.Passes.ProcessPass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
public class LocalInitaliseUser extends ProcessPass<User> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = Global.mainModule.getUser();
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
File workspace = new File(Utils_.getHomeDirectory(), "User");
|
||||
target.workspace = workspace.getAbsolutePath();
|
||||
Utils.CheckAndCleanDirectory(workspace);
|
||||
FileUtils.forceMkdir(target.getLocalProjectsDir());
|
||||
FileUtils.forceMkdir(target.getLocalModulesDir());
|
||||
//-
|
||||
if (!Utils_.isWindows()) {
|
||||
File headerCode = target.getHeaderCodeFile();
|
||||
//-
|
||||
File starterCode = target.getStarterCodeFile();
|
||||
//-
|
||||
File launcherCode = target.getLauncherCodeFile();
|
||||
//-
|
||||
Utils.CreateResourceFile(headerCode);
|
||||
Utils.CreateResourceFile(starterCode);
|
||||
Utils.CreateResourceFile(launcherCode);
|
||||
//-
|
||||
PerformScript(
|
||||
String.join("\n",
|
||||
"cd " + Utils_.DQuotes(target.getLocalModulesDir()),
|
||||
"g++ starter -o starter",
|
||||
"chmod 0777 starter"
|
||||
));
|
||||
PerformScript(String.join("\n",
|
||||
"cd " + Utils_.DQuotes(target.getLocalModulesDir()),
|
||||
"g++ launcher.cpp -o launcher",
|
||||
"chmod 0777 launcher"
|
||||
));
|
||||
}
|
||||
//-
|
||||
target.state = UserState.ready_to_work;
|
||||
Global.mainModule.getDb().Update(target);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user