Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-kotulski committed Feb 26, 2024
1 parent 09d302a commit 933b7f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
15 changes: 6 additions & 9 deletions editor/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,17 @@ export function filesStatus(ctx: Ctx): Cmd {
export function updateTool4D(ctx: Ctx): Cmd {

return async () => {
console.log("update now")
try{
try {
await ctx.downloadLastTool4D()
const userResponse = await vscode.window.showInformationMessage(
`The tool4D has been updated a restart is needed`,
"Reload now"
);

if (userResponse === "Reload now") {
await vscode.commands.executeCommand("workbench.action.reloadWindow");
}
}catch(error)
{
} catch (error) {
const userResponse = await vscode.window.showErrorMessage(
error,
);
Expand All @@ -69,15 +67,14 @@ export function updateTool4D(ctx: Ctx): Cmd {
export function display4DVersion(ctx: Ctx): Cmd {

return async () => {
try{
try {
const version = ctx.get4DVersion()
const userResponse = await vscode.window.showInformationMessage(
`4D Version ${(await version).toString(true)}`,
);


}catch(error)
{

} catch (error) {
const userResponse = await vscode.window.showErrorMessage(
error,
);
Expand Down
23 changes: 9 additions & 14 deletions editor/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,14 @@ export class Config {
return p;
}

private _getInfoplistPath()
{
private _getInfoplistPath() {
let serverPath = this._serverPath;
const type = os.type();
const dirname = path.basename(serverPath);
if (type === "Darwin" && dirname.endsWith(".app")) {
return path.join(serverPath, "Contents", "Info.plist");
}
else if(type === "Windows_NT" || type === "Linux")
{
else if (type === "Windows_NT" || type === "Linux") {
return path.join(serverPath, "..", "Resources", "Info.plist");
}
return serverPath;
Expand Down Expand Up @@ -132,8 +130,8 @@ export class Config {
return serverPath;
}

public get4DVersion() : LabeledVersion{
let labeledVersion = new LabeledVersion(0,0,0,0,false, "stable", false);
public get4DVersion(): LabeledVersion {
let labeledVersion = new LabeledVersion(0, 0, 0, 0, false, "stable", false);

const infoPlistPath = this._getInfoplistPath();
if (fs.existsSync(infoPlistPath)) {
Expand All @@ -142,19 +140,16 @@ export class Config {
if (match !== null && match.length > 1) {
let matchVersion = match[1].match(/(([0-9]*R[0-9])|[0-9]+)\.([0-9]{2,})/)
console.log(matchVersion)
if(matchVersion)
{
if(matchVersion[2])
{
if (matchVersion) {
if (matchVersion[2]) {
labeledVersion = LabeledVersion.fromString(matchVersion[2]);
}
else if(matchVersion[1])
{
else if (matchVersion[1]) {
labeledVersion = LabeledVersion.fromString(matchVersion[1]);
}
if(matchVersion[3]){
if (matchVersion[3]) {
labeledVersion.changelist = Number(matchVersion[3]);
if(labeledVersion.changelist > 0 && labeledVersion.version === 0) {
if (labeledVersion.changelist > 0 && labeledVersion.version === 0) {
labeledVersion.main = true;
}
}
Expand Down

0 comments on commit 933b7f6

Please sign in to comment.