упорядочил папки с кодом.

This commit is contained in:
2023-11-19 01:53:56 +03:00
parent 4883b4af51
commit 44c6daffa3
596 changed files with 2140 additions and 1569 deletions

View File

@@ -0,0 +1,54 @@
package Common.Passes.All;
import Common.Current;
import Common.Global;
import Common.Utils.Utils;
import GlobalData.User.User;
import GlobalData.User.UserState;
import Common.Passes.ProcessPass;
import Common.Passes.SSH.ConnectionPass;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
public class LocalInitaliseUser extends ProcessPass<User> {
@Override
protected boolean canStart(Object... args) throws Exception {
target = Current.getUser();
return true;
}
@Override
protected void body() throws Exception {
File workspace = Paths.get(Global.Home, "User").toFile();
target.workspace = workspace.getAbsolutePath();
Utils.CheckAndCleanDirectory(workspace);
FileUtils.forceMkdir(target.getLocalProjectsDir());
FileUtils.forceMkdir(target.getLocalModulesDir());
//-
if (!Global.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++ " + ConnectionPass.starter_code + " -o " + ConnectionPass.starter,
"chmod 0777 " + ConnectionPass.starter
));
PerformScript(String.join("\n",
"cd " + Utils.DQuotes(target.getLocalModulesDir()),
"g++ " + ConnectionPass.launcher_code + " -o " + ConnectionPass.launcher,
"chmod 0777 " + ConnectionPass.launcher
));
}
//-
target.state = UserState.ready_to_work;
Global.db.Update(target);
}
}