@@ -352,45 +352,55 @@ Amiga::saveWorkspace(const fs::path &path)
352
352
353
353
auto exportADF = [&](FloppyDrive& drive, string name) {
354
354
355
- if (!drive.hasDisk ()) return ;
356
-
357
- string file = name + (config.compressWorkspaces ? " .adz" : " .adf" );
358
-
359
- try {
355
+ if (drive.hasDisk ()) {
360
356
361
- if (config.compressWorkspaces ) {
362
-
363
- ADZFile (ADFFile (drive)).writeToFile (path / file);
364
- } else {
365
- ADFFile (drive).writeToFile (path / file);
366
- }
367
- drive.markDiskAsUnmodified ();
357
+ string file = name + (config.compressWorkspaces ? " .adz" : " .adf" );
368
358
369
- df << " try " << name << " insert " << file << " \n " ;
370
- df << " try " << name << (drive.hasProtectedDisk () ? " protect\n " : " unprotect\n " );
359
+ try {
360
+
361
+ if (config.compressWorkspaces ) {
362
+
363
+ ADZFile (ADFFile (drive)).writeToFile (path / file);
364
+ } else {
365
+ ADFFile (drive).writeToFile (path / file);
366
+ }
367
+ drive.markDiskAsUnmodified ();
368
+
369
+ df << " try " << name << " insert " << file << " \n " ;
370
+ df << " try " << name << (drive.hasProtectedDisk () ? " protect\n " : " unprotect\n " );
371
+
372
+ } catch (...) { }
373
+
374
+ } else {
371
375
372
- } catch (...) { }
376
+ df << " try " << name << " eject\n " ;
377
+ }
373
378
};
374
379
375
380
auto exportHDF = [&](HardDrive& drive, string name) {
376
381
377
- if (!drive.hasDisk ()) return ;
378
-
379
- string file = name + (config.compressWorkspaces ? " .hdz" : " .hdf" );
380
-
381
- try {
382
+ if (drive.hasDisk ()) {
382
383
383
- if (config.compressWorkspaces ) {
384
- HDZFile (HDFFile (drive)).writeToFile (path / file);
385
- } else {
386
- HDFFile (drive).writeToFile (path / file);
387
- }
388
- drive.markDiskAsUnmodified ();
384
+ string file = name + (config.compressWorkspaces ? " .hdz" : " .hdf" );
389
385
390
- hd << " try " << name << " attach " << file << " \n " ;
391
- hd << " try " << name << (drive.hasProtectedDisk () ? " protect\n " : " unprotect\n " );
386
+ try {
387
+
388
+ if (config.compressWorkspaces ) {
389
+ HDZFile (HDFFile (drive)).writeToFile (path / file);
390
+ } else {
391
+ HDFFile (drive).writeToFile (path / file);
392
+ }
393
+ drive.markDiskAsUnmodified ();
394
+
395
+ hd << " try " << name << " attach " << file << " \n " ;
396
+ hd << " try " << name << (drive.hasProtectedDisk () ? " protect\n " : " unprotect\n " );
397
+
398
+ } catch (...) { }
399
+
400
+ } else {
392
401
393
- } catch (...) { }
402
+ hd << " try " << name << " disconnect\n " ;
403
+ }
394
404
};
395
405
396
406
// If a file with the specified name exists, delete it
0 commit comments