1818// JavaCommons imports
1919import picoded .core .common .EmptyArray ;
2020import picoded .core .file .FileUtil ;
21+ import picoded .core .conv .ConvertJSON ;
2122import picoded .dstack .FileWorkspace ;
2223import picoded .dstack .core .Core_FileWorkspaceMap ;
2324
@@ -724,6 +725,7 @@ public void backend_removeFolderPath(final String oid, final String folderPath)
724725 backend_setupWorkspace (oid );
725726 // Ensure any parend dir anchor exists if needed
726727 ensureParentPath (oid , folderPath );
728+
727729 // Remove the respective file
728730 removeFilePathRecursively (oid , folderPath );
729731 }
@@ -837,7 +839,6 @@ public long backend_modifiedTimestamp(final String oid, final String filepath) {
837839 @ Override
838840 public Set <String > backend_getFileAndFolderPathSet (final String oid , String folderPath ,
839841 final int minDepth , final int maxDepth ) {
840-
841842 // Lets build the query for the "root file"
842843 Bson query = null ;
843844
@@ -901,8 +902,9 @@ public Set<String> backend_getFileAndFolderPathSet(final String oid, String fold
901902 // Filter and return the final set
902903 return backend_filterPathSet (ret , folderPath , minDepth , maxDepth , 0 );
903904 }
905+
904906
905- /**
907+ /**
906908 * Internal utility function used to filter a path set, and remove items that does not match.
907909 * This is used to help filter raw results, from existing implementation
908910 *
@@ -929,20 +931,19 @@ protected Set<String> backend_filterPathSet(final Set<String> rawSet, final Stri
929931 int searchPathLen = searchPath .length ();
930932
931933 // // Debugging stuff
932- // System.out.println( "#" );
933- // System.out.println( "searchPath: "+searchPath );
934- // System.out.println( "searchPathLen: "+searchPathLen );
935- // System.out.println( "minDepth: "+minDepth );
936- // System.out.println( "maxDepth: "+maxDepth );
937- // System.out.println( "pathType: "+pathType );
938- // System.out.println( ConvertJSON.fromObject(rawSet) );
934+ System .out .println ( "#" );
935+ System .out .println ( "searchPath: " +searchPath );
936+ System .out .println ( "searchPathLen: " +searchPathLen );
937+ System .out .println ( "minDepth: " +minDepth );
938+ System .out .println ( "maxDepth: " +maxDepth );
939+ System .out .println ( "pathType: " +pathType );
940+ System .out .println ( "rawSet: " + ConvertJSON .fromObject (rawSet ) );
939941
940942 // Return set
941943 Set <String > ret = new HashSet <>();
942944
943945 // Get the keyset, and iterate it
944946 for (String key : rawSet ) {
945- System .out .println ("KEY=" +key );
946947
947948 // Skip the root folder of a workspace
948949 if (key .equals ("" ) || key .equals ("/" )) {
@@ -957,10 +958,8 @@ protected Set<String> backend_filterPathSet(final Set<String> rawSet, final Stri
957958 // If folder path match - store it - maybe?
958959 String subPath = key .substring (searchPathLen );
959960
960- //Dirty Fix for empty folder being deleted instead of moved
961- //Empty folder being considered as "" somehow
962- if (subPath .equals ("" )) {
963- ret .add ("/" );
961+ // Skip the root folder of a subpath
962+ if (subPath .equals ("" ) || subPath .equals ("/" )) {
964963 continue ;
965964 }
966965
@@ -1028,8 +1027,7 @@ protected Set<String> backend_filterPathSet(final Set<String> rawSet, final Stri
10281027 }
10291028
10301029 // // Debugging stuff
1031- // System.out.println( "Filtered Set" );
1032- // System.out.println( ConvertJSON.fromObject(ret) );
1030+ System .out .println ( "Filtered Set: " +ConvertJSON .fromObject (ret ) );
10331031
10341032
10351033 // Return the filtered set
0 commit comments