3737import ij .io .FileInfo ;
3838import ij3d .Content ;
3939import ij3d .ContentConstants ;
40- import sc .fiji .snt .gui .GuiUtils ;
4140
4241/**
4342 * Class handling SNT preferences.
@@ -512,7 +511,7 @@ public static String getDefaultLookAndFeel() {
512511 // If Fiji is using FlatLaf (default of v430 is light) used that as default, otherwise use System L&F
513512 final LookAndFeel currentLaf = GraphicsEnvironment .isHeadless () ? null : UIManager .getLookAndFeel ();
514513 return (currentLaf instanceof FlatLaf && !((FlatLaf ) currentLaf ).isDark ()) ? currentLaf .getName ()
515- : GuiUtils .LAF_DEFAULT ;
514+ : sc . fiji . snt . gui . GuiUtils .LAF_DEFAULT ;
516515 }
517516
518517 private static void clearLegacyPrefs () {
@@ -558,7 +557,7 @@ public File getWorkspaceDir() {
558557 workspaceDirectory = f ;
559558 }
560559 if (workspaceDirectory == null ) {
561- setWorkspaceDir (null );
560+ setWorkspaceDir (null ); // reset to default location
562561 }
563562 }
564563 return workspaceDirectory ;
@@ -575,15 +574,44 @@ public void setWorkspaceDir(final File dir) {
575574 set (WORKSPACE_KEY , workspaceDirectory .getAbsolutePath ());
576575 }
577576
578- public File getQuickBackupDir () {
579- if (!getWorkspaceDir ().exists ()) workspaceDirectory .mkdirs (); // Ensure it exists
577+ /**
578+ * Returns the backup directory, or null if workspace doesn't exist.
579+ * Does NOT create directories.
580+ */
581+ public File getBackupDir () {
582+ if (!getWorkspaceDir ().exists ()) {
583+ return null ;
584+ }
580585 final File result = new File (workspaceDirectory , "snt_backups" );
581586 result .mkdirs ();
582587 return result ;
583588 }
584589
590+ /**
591+ * Creates workspace directory if it doesn't exist.
592+ * @return true if directory exists or was created successfully
593+ */
594+ public boolean ensureWorkspaceExists () {
595+ if (workspaceDirectory .exists ()) return true ;
596+ return workspaceDirectory .mkdirs ();
597+ }
598+
599+ /**
600+ * @return true if workspace directory exists and has write permissions.
601+ */
602+ public boolean workspaceIsValid () {
603+ final File ws = getWorkspaceDir ();
604+ return ws != null && ws .exists () && ws .canWrite ();
605+ }
606+
607+ /**
608+ * Returns the sessions directory, or null if workspace doesn't exist.
609+ * Does NOT create directories.
610+ */
585611 public File getSessionsDir () {
586- if (!getWorkspaceDir ().exists ()) workspaceDirectory .mkdirs (); // Ensure it exists
612+ if (!getWorkspaceDir ().exists ()) {
613+ return null ;
614+ }
587615 final File result = new File (workspaceDirectory , "sessions" );
588616 result .mkdirs ();
589617 return result ;
0 commit comments