Skip to content

Commit 5566e6c

Browse files
authored
Update timestamp when modifying a project (#1337)
1 parent db0bcf4 commit 5566e6c

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/commands/project.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ export async function createProject(node: NodeBase | undefined, api?: AtelierAPI
126126
if (desc !== undefined) {
127127
try {
128128
// Create the project
129-
await api.actionQuery("INSERT INTO %Studio.Project (Name,Description) VALUES (?,?)", [name, desc]);
129+
await api.actionQuery("INSERT INTO %Studio.Project (Name,Description,LastModified) VALUES (?,?,NOW())", [
130+
name,
131+
desc,
132+
]);
130133
} catch (error) {
131134
let message = `Failed to create project '${name}'.`;
132135
if (error && error.errorText && error.errorText !== "") {
@@ -910,6 +913,12 @@ export async function modifyProject(
910913
[]
911914
);
912915
}
916+
if (add.length || remove.length) {
917+
// Update the project's timestamp
918+
await api.actionQuery("UPDATE %Studio.Project SET LastModified = NOW() WHERE Name = ?", [project]).catch(() => {
919+
// Swallow error because VS Code doesn't care about the timestamp
920+
});
921+
}
913922
} catch (error) {
914923
let message = `Failed to modify project '${project}'.`;
915924
if (error && error.errorText && error.errorText !== "") {
@@ -1118,6 +1127,11 @@ export async function addIsfsFileToProject(
11181127
.join(" UNION ")})`,
11191128
[]
11201129
);
1130+
1131+
// Update the project's timestamp
1132+
await api.actionQuery("UPDATE %Studio.Project SET LastModified = NOW() WHERE Name = ?", [project]).catch(() => {
1133+
// Swallow error because VS Code doesn't care about the timestamp
1134+
});
11211135
}
11221136
} catch (error) {
11231137
let message = `Failed to modify project '${project}'.`;
@@ -1223,7 +1237,10 @@ export async function modifyProjectMetadata(nodeOrUri: NodeBase | vscode.Uri | u
12231237
}
12241238

12251239
// Modify the project
1226-
await api.actionQuery("UPDATE %Studio.Project SET Description = ? WHERE Name = ?", [newDesc, project]);
1240+
await api.actionQuery("UPDATE %Studio.Project SET Description = ?, LastModified = NOW() WHERE Name = ?", [
1241+
newDesc,
1242+
project,
1243+
]);
12271244

12281245
// Refesh the explorer
12291246
projectsExplorerProvider.refresh();

src/explorer/explorer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ export function registerExplorerOpen(): vscode.Disposable {
123123
`${prjFileName}${prjType}`.toLowerCase(),
124124
]);
125125
}
126+
// Update the project's timestamp
127+
await api
128+
.actionQuery("UPDATE %Studio.Project SET LastModified = NOW() WHERE Name = ?", [project])
129+
.catch(() => {
130+
// Swallow error because VS Code doesn't care about the timestamp
131+
});
126132
} catch (error) {
127133
let message = `Failed to remove '${fullName}' from project '${project}'.`;
128134
if (error && error.errorText && error.errorText !== "") {

0 commit comments

Comments
 (0)