@@ -71,11 +71,7 @@ ofxVisualProgramming::ofxVisualProgramming(){
7171 livePatchingObiID = -1 ;
7272
7373 currentPatchFile = " empty_patch.xml" ;
74- #if defined (TARGET_WIN32)
75- currentPatchFolderPath = ofToDataPath (" temp\" );
76- #else
7774 currentPatchFolderPath = ofToDataPath (" temp/" );
78- #endif
7975
8076
8177 currentSubpatch = " root" ;
@@ -452,11 +448,7 @@ void ofxVisualProgramming::resetTempFolder(){
452448void ofxVisualProgramming::cleanPatchDataFolder (){
453449 ofDirectory dir;
454450 // get patch data folder
455- #if defined (TARGET_WIN32)
456- dir.listDir (currentPatchFolderPath+" data\" );
457- #else
458451 dir.listDir (currentPatchFolderPath+" data/" );
459- #endif
460452
461453
462454 for (size_t i = 0 ; i < dir.size (); i++){
@@ -503,9 +495,12 @@ void ofxVisualProgramming::exit(){
503495 deactivateDSP ();
504496 }
505497
498+ #ifndef TARGET_WIN32
506499 cleanPatchDataFolder ();
507500
508501 resetTempFolder ();
502+ #endif
503+
509504}
510505
511506// --------------------------------------------------------------
@@ -1023,7 +1018,8 @@ void ofxVisualProgramming::removeObject(int &id){
10231018// --------------------------------------------------------------
10241019void ofxVisualProgramming::duplicateObject (int &id){
10251020 // disable duplicate for hardware&system related objects
1026- if(patchObjects[id]->getName() != "audio device" && patchObjects[id]->getName() != "video grabber" && patchObjects[id]->getName() != "kinect grabber" && patchObjects[id]->getName() != "live patching" && patchObjects[id]->getName() != "projection mapping"){
1021+ if (!patchObjects[id]->getIsHardwareObject ()){
1022+ // if(patchObjects[id]->getName() != "audio device" && patchObjects[id]->getName() != "kinect grabber" && patchObjects[id]->getName() != "live patching"){
10271023 // ofVec2f newPos = ofVec2f(patchObjects[id]->getPos().x + patchObjects[id]->getObjectWidth(),patchObjects[id]->getPos().y);
10281024 addObject (patchObjects[id]->getName (),patchObjects[id]->getPos ());
10291025 }else {
@@ -1163,11 +1159,7 @@ void ofxVisualProgramming::newPatch(string release){
11631159 XML.saveFile ();
11641160 }
11651161
1166- #if defined (TARGET_WIN32)
1167- ofFile newPatchFile(ofToDataPath(" temp\" +newFileName,true));
1168- #else
11691162 ofFile newPatchFile (ofToDataPath (" temp/" +newFileName,true ));
1170- #endif
11711163
11721164 ofFile::copyFromTo (fileToRead.getAbsolutePath (),newPatchFile.getAbsolutePath (),true ,true );
11731165
@@ -1181,21 +1173,12 @@ void ofxVisualProgramming::newPatch(string release){
11811173void ofxVisualProgramming::newTempPatchFromFile (string patchFile){
11821174 string newFileName = " patch_" +ofGetTimestampString (" %y%m%d" )+alphabet.at (newFileCounter)+" .xml" ;
11831175 ofFile fileToRead (patchFile);
1184- #if defined (TARGET_WIN32)
1185- ofFile newPatchFile(ofToDataPath(" temp\" +newFileName,true));
1186- ofFile::copyFromTo(fileToRead.getAbsolutePath(),newPatchFile.getAbsolutePath(),true,true);
1187-
1188- ofDirectory dataFolderOrigin;
1189- dataFolderOrigin.listDir(fileToRead.getEnclosingDirectory()+" \data\" );
1190- std::filesystem::path tp = ofToDataPath(" temp\data\" ,true);
1191- #else
11921176 ofFile newPatchFile (ofToDataPath (" temp/" +newFileName,true ));
11931177 ofFile::copyFromTo (fileToRead.getAbsolutePath (),newPatchFile.getAbsolutePath (),true ,true );
11941178
11951179 ofDirectory dataFolderOrigin;
11961180 dataFolderOrigin.listDir (fileToRead.getEnclosingDirectory ()+" /data/" );
11971181 std::filesystem::path tp = ofToDataPath (" temp/data/" ,true );
1198- #endif
11991182
12001183 dataFolderOrigin.copyTo (tp,true ,true );
12011184
@@ -1246,11 +1229,7 @@ void ofxVisualProgramming::openPatch(string patchFile){
12461229 ofFile temp (currentPatchFile);
12471230 currentPatchFolderPath = temp.getEnclosingDirectory ();
12481231
1249- #if defined (TARGET_WIN32)
1250- ofFile patchDataFolder(currentPatchFolderPath+" data\" );
1251- #else
12521232 ofFile patchDataFolder (currentPatchFolderPath+" data/" );
1253- #endif
12541233
12551234 if (!patchDataFolder.exists ()){
12561235 patchDataFolder.create ();
@@ -1497,31 +1476,17 @@ void ofxVisualProgramming::savePatchAs(string patchFile){
14971476 string newFileName = checkFileExtension (sanitizedPatchFile, ofToUpper (tempFile.getExtension ()), " XML" );
14981477 ofFile fileToRead (currentPatchFile);
14991478 ofDirectory dataFolderOrigin;
1500- #if defined (TARGET_WIN32)
1501- dataFolderOrigin.listDir(currentPatchFolderPath+" data\" );
1502- #else
15031479 dataFolderOrigin.listDir (currentPatchFolderPath+" data/" );
1504- #endif
15051480
15061481 ofFile newPatchFile (newFileName);
15071482
1508- #if defined (TARGET_WIN32)
1509- currentPatchFile = newPatchFile.getEnclosingDirectory()+finalTempFileName+" \" +newPatchFile.getFileName();
1510- ofFile temp(currentPatchFile);
1511- currentPatchFolderPath = temp.getEnclosingDirectory();
1512-
1513- ofFile::copyFromTo(fileToRead.getAbsolutePath(),currentPatchFile,true,true);
1514-
1515- std::filesystem::path tp = currentPatchFolderPath+" \data\" ;
1516- #else
15171483 currentPatchFile = newPatchFile.getEnclosingDirectory ()+finalTempFileName+" /" +newPatchFile.getFileName ();
15181484 ofFile temp (currentPatchFile);
15191485 currentPatchFolderPath = temp.getEnclosingDirectory ();
15201486
15211487 ofFile::copyFromTo (fileToRead.getAbsolutePath (),currentPatchFile,true ,true );
15221488
15231489 std::filesystem::path tp = currentPatchFolderPath+" /data/" ;
1524- #endif
15251490
15261491 dataFolderOrigin.copyTo (tp,true ,true );
15271492
0 commit comments