mirror of
https://github.com/UiO-Gaming/infoscreen3.git
synced 2026-11-05 13:56:52 +01:00
Merge pull request #77 from kasimos/fixDuplicateMaster
Fix duplication of video and webpage slides
This commit is contained in:
1 file changed
+20
-22
+20
-22
@@ -48,29 +48,27 @@ export default class bundleClass {
|
||||
duplicateUuid(uuid) {
|
||||
for (let slide of this.allSlides) {
|
||||
if (slide.uuid === uuid) {
|
||||
if (slide.type === "slide") {
|
||||
let newId = uuidv4();
|
||||
let path = process.cwd() + "/data/bundles/" + this.name;
|
||||
try {
|
||||
uuid = checkAndSanitizeFilePathName(uuid)
|
||||
// duplicate at filesystem
|
||||
if (fs.existsSync(path + "/render/" + uuid + ".png")) {
|
||||
fs.copyFileSync(path + "/render/" + uuid + ".png", path + "/render/" + newId + ".png");
|
||||
}
|
||||
if (fs.existsSync(path + "/slides/" + uuid)) {
|
||||
fs.copyFileSync(path + "/slides/" + uuid, path + "/slides/" + newId);
|
||||
}
|
||||
|
||||
// duplicate at json
|
||||
let newSlide = clone(slide);
|
||||
newSlide.uuid = newId;
|
||||
this.allSlides.push(newSlide);
|
||||
this.save();
|
||||
return;
|
||||
} catch (err) {
|
||||
cli.error("error while duplicating file:" + uuid, err);
|
||||
return;
|
||||
let newId = uuidv4();
|
||||
let path = process.cwd() + "/data/bundles/" + this.name;
|
||||
try {
|
||||
uuid = checkAndSanitizeFilePathName(uuid)
|
||||
// duplicate at filesystem
|
||||
if (fs.existsSync(path + "/render/" + uuid + ".png")) {
|
||||
fs.copyFileSync(path + "/render/" + uuid + ".png", path + "/render/" + newId + ".png");
|
||||
}
|
||||
if (fs.existsSync(path + "/slides/" + uuid)) {
|
||||
fs.copyFileSync(path + "/slides/" + uuid, path + "/slides/" + newId);
|
||||
}
|
||||
|
||||
// duplicate at json
|
||||
let newSlide = clone(slide);
|
||||
newSlide.uuid = newId;
|
||||
this.allSlides.push(newSlide);
|
||||
this.save();
|
||||
return;
|
||||
} catch (err) {
|
||||
cli.error("error while duplicating file:" + uuid, err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user