Fixed major issues master
authorJerome St-Louis <jerome@ecere.com>
Mon, 7 Sep 2020 01:02:15 +0000 (21:02 -0400)
committerJerome St-Louis <jerome@ecere.com>
Mon, 7 Sep 2020 01:02:15 +0000 (21:02 -0400)
- Files were not showing at startup
- Toggling details wasn't working
- Toggling showcase didn't reset the view properly

explorer/explorer.epj
explorer/src/DeleteBox.ec
explorer/src/Explorer.ec
explorer/src/ExplorerWindow.ec
explorer/src/Finder.ec
libede/EDE.epj
libede/src/CreateNewFileDialog.ec
libede/src/FileSystemBox.ec
libede/src/FileSystemCache.ec
libede/src/FileSystemIterator.ec
libede/src/FileSystemSearch.ec

index 804866e..39cea87 100644 (file)
          "Folder" : "extern",
          "Files" : [
             {
-               "FileName" : "../../../sdk/extras/gui/controls/ToolBar.ec",
+               "FileName" : "$(ECERE_SDK_SRC)/extras/gui/controls/ToolBar.ec",
                "Options" : {
                   "ExcludeFromBuild" : true
                }
             },
-            "../../../sdk/extras/gui/controls/SearchBox.ec"
+            "$(ECERE_SDK_SRC)/extras/gui/controls/SearchBox.ec"
          ],
          "Configurations" : [
             {
index d9c2d08..e91f52c 100644 (file)
@@ -14,7 +14,7 @@ public:
    ListBox source;
 
 private:
-   
+
    ListBox list
    {
       parent = this, borderStyle = deep, hasVertScroll = true, hasHorzScroll = true;
@@ -73,7 +73,7 @@ private:
             }
             // what if a child of some parent was added before that parent, should check to remove
             // or is it imposible to get the backwards order from GetMultiSelection
-            
+
             //for(branch = (ExplorerFileBranch)row.tag; branch; branch = branch.parent)
             //   branches.Add(branch);
          }
@@ -94,11 +94,11 @@ private:
                parent.DuplicateChildren(true, true, root, list);
             }
          }
-         
+
          */
          /*
          copies.count = branches.count;
-         
+
          {
             bool added = true;
             uint b;
index 134b675..6b9f872 100644 (file)
@@ -46,12 +46,13 @@ class Explorer : GuiApplication
             openArgsStartAt = 2;
          else if(!strcmpi(argv[1], "find") && argc > 2)
          {
-            char * unquoted;
             if(argv[2][0] == '\"')
-               StripQuotes(argv[2], unquoted);
+            {
+               findWhat = new char[strlen(argv[2])+1];
+               StripQuotes(argv[2], findWhat);
+            }
             else
-               unquoted = argv[2];
-            findWhat = CopyString(unquoted);
+               findWhat = CopyString(argv[2]);
             if(argc > 3)
             {
                if(!strcmpi(argv[3], "in") && argc > 4)
@@ -61,7 +62,7 @@ class Explorer : GuiApplication
             }
             else
                searchPath = ""; // same
-         } 
+         }
          else if(!strcmpi(argv[1], "search") && argc > 2)
             searchPath = argv[2];
          else if(!strcmpi(argv[1], "compare") && argc > 2)
@@ -71,11 +72,11 @@ class Explorer : GuiApplication
             if(argc == 3)
             {
                goPath = ""; // current dir
-               comparedPaths.Add(goPath);
+               comparedPaths.Add(CopyString((const char *)goPath));  // TODO: Review whether this gets freed?
             }
             for(c = 2; c < argc; c++)
             {
-               char * s;
+               const char * s;
                goPath = argv[c];
                s = goPath;
                if(s)
@@ -106,6 +107,8 @@ class Explorer : GuiApplication
                explorerWnd.Create();
                explorerWnd.location = goPath;//explorerWnd.GoTo(goPath, false, false);
             }
+            if(openArgsStartAt == -1)
+               break;
          }
       }
       else if(searchPath)
@@ -121,8 +124,14 @@ class Explorer : GuiApplication
          explorerWnd.Create();
          explorerWnd.view.columnsCompareStyle = true;
          explorerWnd.comparedLocations = comparedPaths;
+         comparedPaths = null;
          // delete comparedPaths;
       }
+      if(comparedPaths)
+      {
+         comparedPaths.Free();
+         delete comparedPaths;
+      }
       return true;
    }
 }
@@ -131,17 +140,20 @@ struct QuickPathTool
 {
    char path[MAX_LOCATION];
 
-   property char * 
+   property const char *
    {
       set
       {
-         char * unquoted;
          GetWorkingDir(path, MAX_LOCATION);
          if(value[0] == '\"')
+         {
+            char * unquoted = new char[strlen(value) + 1];
             StripQuotes(value, unquoted);
+            PathCat(path, unquoted);
+            delete unquoted;
+         }
          else
-            unquoted = value;
-         PathCat(path, unquoted);
+            PathCat(path, value);
          if(!FileExists(path))
          {
             // this incomplete functionality is not quite at it's place in this class
@@ -152,7 +164,7 @@ struct QuickPathTool
                StripLastDirectory(path, path);
                if(FileExists(path))
                {
-                  // TODO: message location does not exist, 
+                  // TODO: message location does not exist,
                   //       this higher location exists though
                   //       go there?
                   break;
@@ -160,7 +172,7 @@ struct QuickPathTool
             }
             if(!len)
             {
-               // TODO: message location does not exist, 
+               // TODO: message location does not exist,
                //       unable to select alternate location
             }
             path[0] = '\0';
index f1c0a2d..eb690c3 100644 (file)
@@ -66,7 +66,7 @@ enum Icon
    searchInSubDirs, searchStart, searchStop,
    hasHeader
 };
-static char * iconNames[Icon::enumSize] =
+static const char * iconNames[Icon::enumSize] =
 {
    "<:ecere>emblems/unreadable.png",         /* missing */
 
@@ -152,7 +152,7 @@ class ExplorerWindow : Window
 
    int treeSplit;
    int searchSplit;
-   
+
    ExplorerToolId lastViewId;
 */
 
@@ -162,7 +162,7 @@ class ExplorerWindow : Window
 
 
    menu = Menu { };
-   
+
    Menu fileMenu { menu, "File", f };
    Menu windowMenu { menu, "Window", w };
       MenuItem itemNewWindow { windowMenu, "New Window", n, NotifySelect = NewWindow_NotifySelect };
@@ -445,7 +445,7 @@ class ExplorerWindow : Window
    IconToolButton goUp { toolBar, this, icon = goUp, hotKey = { up, alt = true }, toolTip = "Go to Parent Folder";
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
-         char * path = view.path;
+         const char * path = view.path;
          char * newPath = new char[strlen(path)+1];
          StripLastDirectory(path, newPath);
          if(!newPath[0])
@@ -532,7 +532,7 @@ class ExplorerWindow : Window
    ToggleIconToolButton viewDetails  { toolBar, this, icon = viewDetails, toolTip = "Toggle Listing Details";
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
-         view.details = true;
+         view.details = button.checked;
          view.treeBranches = false;
          view.Refresh();
          view.Activate();
@@ -881,6 +881,7 @@ class ExplorerWindow : Window
       {
          //((FileSystemCacheIterator)fileSystemIterator).cache = testCache;
          //((FileSystemIterator)fileSystemIterator)
+         return true;
       }
 
       bool NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection)
@@ -931,7 +932,7 @@ class ExplorerWindow : Window
 
          //PrintLn(node.name);
          if(box.selection.nodes.count == 1)
-            itemString = node.name;
+            itemString = CopyString(node.name);
          else
             itemString = PrintString(box.selection.nodes.count, " items");
          text = PrintString("Open ", itemString);
@@ -1102,6 +1103,7 @@ class ExplorerWindow : Window
          if(CreateNewFileDialog { /*master = */ew/*, parent = parent*/, currentDirectory = selection ? ew.view.selection.node.path : ew.view.path }.Modal() == ok )
             ew.Refresh();
       }
+      return true;
    }
 
    //void NewFolder()
@@ -1113,10 +1115,11 @@ class ExplorerWindow : Window
          if(CreateDirectoryDialog { /*master = */ew/*, parent = parent*/, currentDirectory = selection ? ew.view.selection.node.path : ew.view.path }.Modal() == ok )
             ew.Refresh();
       }
+      return true;
    }
 
    //void GoTo(char * location/*, bool viewIsAtLocation, bool treeIsAtLocation*/)
-   property char * location
+   property const char * location
    {
       set
       {
@@ -1204,24 +1207,27 @@ class ExplorerWindow : Window
 
    void UpdateHistoryItem(FileSystemBoxSelection selection)
    {
-      HistoryItem item = history[historyIndex];
-
-      if(!item.holdRecordingSelection)
+      if(history.count > historyIndex)   // TODO: Review why this would happen...
       {
-         if(selection.node || (selection.nodes && selection.nodes.count))
+         HistoryItem item = history[historyIndex];
+
+         if(!item.holdRecordingSelection)
          {
-            item.selection.Free();
-            if(selection.nodes.count)
+            if(selection.node || (selection.nodes && selection.nodes.count))
             {
-               for(node : selection.nodes)
-                  item.selection.Add(CopyString(node.path));
+               item.selection.Free();
+               if(selection.nodes.count)
+               {
+                  for(node : selection.nodes)
+                     item.selection.Add(CopyString(node.path));
+               }
+               else if(selection.node)
+                  item.selection.Add(CopyString(selection.node.path));
             }
-            else if(selection.node)
-               item.selection.Add(CopyString(selection.node.path));
          }
+         else
+            item.holdRecordingSelection = false;
       }
-      else
-         item.holdRecordingSelection = false;
    }
 
    void SearchStart()
@@ -1317,7 +1323,7 @@ class ExplorerWindow : Window
       }
       return true;
    }*/
-   
+
    /*bool ViewNotifyItemOpen(ExplorerView view, ExplorerFileItem item)
    {
       ExplorerFileBranch branch = tree.branch;
@@ -1326,14 +1332,14 @@ class ExplorerWindow : Window
          if(item.type.isFolderType)
          {
             ExplorerFileBranch child;
-            
+
             if(!branch.loaded || !branch.childrenLoaded)
                BranchLoad(branch, tree.tree);
 
             for(child = branch.children.first; child; child = child.next)
                if(!strcmp(child.name, item.name))
                   break;
-            
+
             if(child)
             {
                if(branch.row.collapsed)
@@ -1384,6 +1390,7 @@ class ExplorerWindow : Window
       //userMode = true;
       addressBar.path = view.path;
       ReadyTree();
+      view.Refresh();
       return true;
    }
 
@@ -1409,7 +1416,7 @@ class ExplorerWindow : Window
          NotifyItemOpen = ViewNotifyItemOpen;
       };
       lastViewId = viewList;
-      
+
       tree.Load();
       view.Load(tree.root);
    }*/
index c65367f..42e2d58 100644 (file)
@@ -31,7 +31,7 @@ public:
    void SearchStart()
    {
       char text[2048];
-      
+
       searchThread.active = true;
 
       searchThread.optionSubdirs = options.subdirs.checked;
@@ -45,7 +45,7 @@ public:
       strcpy(searchThread.location, location.GetText());
       strcpy(searchThread.nameSearch, findName.GetText());
       strcpy(searchThread.contentSearch, findTextContent.GetText());
-      
+
       actions.startStop.text = "Stop Search";
       actions.clear.disabled = false;
       view.results.Clear();
@@ -57,7 +57,7 @@ public:
       view.browser.text = "Browser";
       sprintf(text, "Search Results (Searching %s)", location.GetText());
       view.results.text = text;
-      
+
       searchThread.Create();
    }
 
@@ -104,7 +104,7 @@ public:
    void SearchTerminate()
    {
       char text[1024];
-      
+
       if(searchThread.terminate)
          sprintf(text, "Search Results (%d item(s) found), Search was aborted.", searchThread.matchCount);
       else
@@ -112,7 +112,7 @@ public:
       view.results.text = text;
       sprintf(text, "Browser (%d item(s) searched)", searchThread.count);
       view.browser.text = text;
-         
+
       actions.startStop.text = "Start Search";
    }
 
@@ -190,7 +190,7 @@ class ExplorerSearchView : ExplorerView
 
 class ExplorerSearchViewTree : ExplorerSearchView
 {
-   
+
    DataField resultsFieldPath { "char *" };
 
    ListBox results
@@ -252,9 +252,9 @@ class ExplorerSearchViewTree : ExplorerSearchView
          {
             OldList selection;
             Link item;
-            
+
             listBox.GetMultiSelection(selection);
-            
+
             for(item = selection.first; item; item = item.next)
             {
                char path[MAX_LOCATION];
@@ -274,7 +274,7 @@ class ExplorerSearchViewTree : ExplorerSearchView
    }
 
    bool Lists_NotifyDoubleClick(ListBox listBox, int x, int y, Modifiers mods)
-   {  
+   {
       if(listBox.currentRow)
       {
          char path[MAX_LOCATION];
index 7fb0b90..6509ee5 100644 (file)
@@ -6,8 +6,6 @@
       "DefaultNameSpace" : "ede",
       "TargetType" : "SharedLibrary",
       "TargetFileName" : "EDE",
-      "TargetDirectory" : "obj/$(CONFIG).$(PLATFORM)",
-      "ObjectsDirectory" : "obj/$(CONFIG).$(PLATFORM)",
       "Libraries" : [
          "ecere"
       ]
index 49755a0..0c793cb 100644 (file)
@@ -10,7 +10,7 @@ public class CreateNewFileDialog : Window
 
 public:
 
-   property char * currentDirectory
+   property const char * currentDirectory
    {
       set
       {
@@ -18,7 +18,7 @@ public:
          PathCat(currentDirectory, value);
          FileFixCase(currentDirectory);
       }
-      get { return (char *)currentDirectory; }
+      get { return currentDirectory; }
    };
 
 private:
@@ -27,7 +27,7 @@ private:
 
    CreateNewFileDialog()
    {
-      FileNameType c;
+      //FileNameType c;
 
       GetWorkingDir(currentDirectory, MAX_DIRECTORY);
       FileFixCase(currentDirectory);
index 36e6b7b..8842cf1 100644 (file)
@@ -3,22 +3,22 @@ import "FileSystemCache"
 
 #ifdef __WIN32__
 static char * rootName = "Entire Computer";
-static char * msNetwork = "Microsoft Windows Network";
+static const char * msNetwork = "Microsoft Windows Network";
 #else
-static char * rootName = "File System";
+static const char * rootName = "File System";
 #endif
 
 private:
 define guiApp = (GuiApplication)((__thisModule).application);
 define selectionColor = guiApp.currentSkin.selectionColor; //Color { 10, 36, 106 };
 
-void MessageBoxTodo(char * message)
+void MessageBoxTodo(const char * message)
 {
    PrintLn("MessageBoxTodo(char * message) -- ", message);
    MessageBox { type = ok, text = "MessageBoxTodo(char * message)", contents = message }.Modal();
 }
 
-static char * fileIconNames[] =
+static const char * fileIconNames[] =
 {
    "<:ecere>mimeTypes/file.png",         /* none */
 
@@ -53,12 +53,12 @@ static char * fileIconNames[] =
 
    "<:ecere>mimeTypes/package.png",      /* treeLoader */
    "<:ecere>places/startHere.png",                /* lineNumbers */
-   
+
    ""
 };
 
 define countOfCompIconNames = 6;
-static char * compIconNames[] =
+static const char * compIconNames[] =
 {
 /*
    "<:ede>a.png",
@@ -79,19 +79,19 @@ static char * compIconNames[] =
 public enum _FileType
 {
    none,
-   
+
    normalFile, ewsFile, epjFile, ecFile, ehFile, cFile, hFile, cppFile, hppFile,
    textFile, webFile, pictureFile, soundFile,
    archiveFile, packageFile, opticalMediaImageFile, /* these (all previous) are sort equal */
-   
+
    folder, folderOpen, computer,
    drive, netDrive, cdrom, removable, floppy, network, server, share, // these are sort equal
-   
+
    // utilities
    treeLoader,
    lineNumbers;
 
-   /*property char * 
+   /*property char *
    {
       set
       {
@@ -212,8 +212,8 @@ public:
    virtual bool Window::NotifyNodeOpen(FileSystemBox box, FileSystemBoxSelection selection);
    virtual bool Window::NotifyNodeMenu(FileSystemBox box, Menu menu, FileSystemBoxSelection selection);
    virtual bool Window::NotifyIteratorInit(FileSystemBox box, FileSystemIterator fileSystemIterator);
-   
-   property char * path
+
+   property const char * path
    {
       set
       {
@@ -233,7 +233,11 @@ public:
    {
       set
       {
-         delete comparedPaths;
+         if(comparedPaths)
+         {
+            comparedPaths.Free();
+            delete comparedPaths;
+         }
          if(value && value.count)
             comparedPaths = value;
          if(locationBox)
@@ -277,12 +281,17 @@ public:
          split.leftPane = value ? list : null;
          split.visible = value;
          show.visible = value;
+         if(!value)
+         {
+            list.parent = this;
+            list.anchor = Anchor { left = 0, top = 0, right = 0, bottom = 0 };
+         }
       }
       get { return bits.preview; }
    };
    property bool columnsCompareStyle { set { bits.columnsCompareStyle = value; } get { return bits.columnsCompareStyle; } };
    property bool textFileLinesStyle { set { bits.textFileLinesStyle = value; } get { return bits.textFileLinesStyle; } };
-   
+
    property FileSystemNode node
    {
       get
@@ -334,7 +343,7 @@ public:
       delete map;
    }
 
-   FileSystemNode SelectLocation(char * location)
+   FileSystemNode SelectLocation(const char * location)
    {
       int c;
       char * temp;
@@ -355,7 +364,7 @@ public:
 
       for(c = steps.count - 1; c >= 0; c--)
       {
-         char * t = steps[c];
+         //char * t = steps[c];
          node = Find(steps[c], node);
          if(!node)
             break;
@@ -418,6 +427,7 @@ public:
    bool MenuOpen(MenuItem selection, Modifiers mods)
    {
       OpenNode();
+      return true;
    }
 
    bool MenuReplaceListItemByContainingDir(MenuItem selection, Modifiers mods)
@@ -467,7 +477,10 @@ private:
 
    FileSystemBox()
    {
-      path = CopyString("");
+      char wd[MAX_LOCATION];
+      GetWorkingDir(wd, sizeof(wd));
+      property::path = wd;
+
       InitFileIcons();
       InitCompIcons(); // todo: these icons should not be initialize, they should be set
                        //       or at least initalized when the comparison listing is requested
@@ -479,6 +492,11 @@ private:
 
    ~FileSystemBox()
    {
+      if(comparedPaths)
+      {
+         comparedPaths.Free();
+         delete comparedPaths;
+      }
       delete extensions;
       delete path;
    }
@@ -584,7 +602,7 @@ private:
          }
          return true;
       }
-      
+
       bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods)
       {
          DataRow row = listBox.currentRow;
@@ -626,8 +644,8 @@ private:
                popup = PopupMenu
                   {
                      master = this, menu = menu,
-                     position = { 
-                        x + clientStart.x + absPosition.x - guiApp.desktop.position.x, 
+                     position = {
+                        x + clientStart.x + absPosition.x - guiApp.desktop.position.x,
                         y + clientStart.y + absPosition.y - guiApp.desktop.position.y }
                   };
                popup.Create();
@@ -696,7 +714,7 @@ private:
       {
          if(row)
          {
-            FileSystemNode node = (FileSystemNode)row.tag;
+            //FileSystemNode node = (FileSystemNode)row.tag;
          }
          return true;
       }
@@ -705,7 +723,7 @@ private:
       {
          if(row)
          {
-            FileSystemNode node = (FileSystemNode)row.tag;
+            //FileSystemNode node = (FileSystemNode)row.tag;
          }
          return true;
       }
@@ -714,7 +732,7 @@ private:
       {
          if(row)
          {
-            FileSystemNode node = (FileSystemNode)row.tag;
+            //FileSystemNode node = (FileSystemNode)row.tag;
          }
          return true;
       }
@@ -728,20 +746,20 @@ private:
 
       bool NotifyKeyDown(ListBox listBox, DataRow row, Key key, unichar ch)
       {
-         bool result;
+         //bool result = false;
          if((SmartKey)key == enter)
-            result = OpenNode();
+            /*result = */OpenNode();
          #if 0
          else if((SmartKey)key == f2)
-            result = RenameNode();
+            /*result = */RenameNode();
          #endif
          else if((SmartKey)key == f2)
          {
             FileSystemNode node = selection.node;
             node.row.Edit(nameField);
          }
-         else
-            result = true;
+         //else
+            //result = true;
          return true;
       }
    };
@@ -774,12 +792,12 @@ private:
             int wWnd = fsb.show.clientSize.w;
             int hWnd = fsb.show.clientSize.h;
 
-            int wList = 0;//fsb.list.size.w + fsb.split.size.w;
+            //int wList = 0;//fsb.list.size.w + fsb.split.size.w;
 
-            float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp);
+            //float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp);
 
-            int wDraw = (int)(wBmp * scale);
-            int hDraw = (int)(hBmp * scale);
+            //int wDraw = (int)(wBmp * scale);
+            //int hDraw = (int)(hBmp * scale);
 
       #ifndef __linux__
             surface.Filter(fsb.bitmap, (wWnd - wDraw) / 2, (hWnd - hDraw) / 2, 0, 0, wDraw, hDraw, wBmp, hBmp);
@@ -794,7 +812,7 @@ private:
             surface.Area(0, 0, fsb.clientSize.w - 1, fsb.clientSize.h - 1);
          }
       }
-   }
+   };
 
    bool OpenNode()
    {
@@ -860,7 +878,7 @@ private:
    MenuItem itemEditPaste
    {
       editMenu, "Paste\tCtrl+V", p;
-   
+
       bool NotifySelect(MenuItem selection, Modifiers mods)
       {
          //EditPaste();
@@ -878,7 +896,7 @@ private:
       }
    };
 
-   // WHY is this crashing ? 
+   // WHY is this crashing ?
    /*void OnResize(int width, int height)
    {
       if(this && nameField)
@@ -964,22 +982,23 @@ private:
    {
       bool isRoot = !strcmp(path, "/");
       char name[MAX_LOCATION];
-      FileSystemNode parent;
-      FileSystemNode node;
-      FileListing listing { path, extensions = extensions };
+      //FileSystemNode parent;
+      //FileSystemNode node;
+      //FileListing listing { path, extensions = extensions };
 
       if(!isRoot)
          GetLastDirectory(path, name);
       else
          name[0] = '\0';
-      
+
       /*if(!path)
          GetWorkingDir(startPath, sizeof(startPath));
       else
          strcpy(path, startPath);*/
-      
       bits.mode = directory;
 
+      list.Clear();
+
       delete root;
 #ifdef __WIN32__
       if(isRoot)
@@ -1101,7 +1120,7 @@ private:
       }
    }
 
-   bool ListIterator_OnObject(char * name, char * path, FileStats stats, bool isRootObject)
+   bool ListIterator_OnObject(const char * name, const char * path, FileStats stats, bool isRootObject)
    {
       ProcessListItem(name, path, stats, false);
       return false;
@@ -1109,7 +1128,7 @@ private:
 
    //void ListIterator_OnLeavingDirectory(char * path) { }
 
-   void ProcessListItem(char * name, char * path, FileStats stats, bool isListItem)
+   void ProcessListItem(const char * name, const char * path, FileStats stats, bool isListItem)
    {
       if((!bits.foldersOnly && !bits.filesOnly) || (bits.foldersOnly && stats.attribs.isDirectory) || (bits.filesOnly && stats.attribs.isFile))
       {
@@ -1188,17 +1207,21 @@ private:
          FileListing listing { path, extensions = extensions };
          while(listing.Find())
          {
-            char * test;
+            //char * test;
             FileSystemNode child = null;
             if((!bits.foldersOnly && !bits.filesOnly) ||
                (bits.foldersOnly && listing.stats.attribs.isDirectory) ||
                (bits.filesOnly && listing.stats.attribs.isFile))
                child = MakeAndAddToTreeFileSystemNodeFromFileListing(listing, parent);
             if(child)
+            {
                added = true;
-            test = child.name;
-            if(!test)
-               PrintLn("error");
+               /*
+               test = child.name;
+               if(!test)
+                  PrintLn("error");
+               */
+            }
          }
          if(!added)
             added = true;
@@ -1208,7 +1231,7 @@ private:
 
    void LoadComparedList()
    {
-      int c, cmp/*, smallest*/, icon;//, equalCount;
+      int c/*, cmp*/ /*, smallest*/, icon;//, equalCount;
       int count = comparedPaths ? comparedPaths.count : 0;
       //bool allDone = false;
       bool not;
@@ -1452,7 +1475,7 @@ private:
    void AddNode(FileSystemNode node)
    {
       DataRow row = list.AddRow();
-      row.tag = (int)node;
+      row.tag = (intptr)node;
       node.row = row;
       incref node;
       row.SetData(nameField, node);
@@ -1484,7 +1507,7 @@ private:
          (bits.filesOnly && listing.stats.attribs.isFile)))*/
       {
          bool textFileLinesStyle = false;
-         char * test = listing.name;
+         const char * test = listing.name;
          if(!test)
             PrintLn("error");
          result = MakeFileSystemNode(listing.stats, listing.name, listing.path, false, bits.previewPictures, false, displaySystem);
@@ -1521,7 +1544,7 @@ private:
          node.indent = addTo.indent + 1;
          addTo.children.Add(node);
       }
-      row.tag = (int)node;
+      row.tag = (intptr)node;
       node.row = row;
       row.SetData(null, node);
       if(bits.pathColumn)
@@ -1669,7 +1692,7 @@ public:
       location.GetPath(path);
       {
          FileListing listing { path };
-         
+
          ExplorerFileItem item;
          DataRow row;
 
@@ -1724,7 +1747,7 @@ public:
       location.GetPath(path);
       {
          FileListing listing { path };
-         
+
          ExplorerFileItem item;
          DataRow row;
 
@@ -1773,7 +1796,7 @@ public:
       location.GetPath(path);
       {
          FileListing listing { path };
-         
+
          ExplorerFileItem item;
          DataRow row;
 
@@ -1820,7 +1843,7 @@ public:
       location.GetPath(path);
       {
          FileListing listing { path };
-         
+
          ExplorerFileItem item;
          DataRow row;
 
@@ -1866,7 +1889,7 @@ public:
       {
          _[c].Free();
          delete _[c];
-      }  
+      }
       count = 0;
       size = 0;
    }
@@ -1905,9 +1928,9 @@ public:
             int hWnd = clientSize.h;
 
             int wList = view.list.size.w + view.split.size.w;
-            
+
             float scale = Min((float)(wWnd - 10) / wBmp, (float)(hWnd - 10) / hBmp);
-            
+
             int wDraw = (int)(wBmp * scale);
             int hDraw = (int)(hBmp * scale);
 
@@ -1958,10 +1981,10 @@ public:
       for(pos = 0; pos < selectedItems.count; pos++)
       {
          Bitmap bitmap { };
-         selItem = (ExplorerFileItem)selectedItems._[pos]; 
+         selItem = (ExplorerFileItem)selectedItems._[pos];
          bitmap.Load(selItem.path, null, displaySystem);
          //view.bitmaps.Add(bitmap);
-      }  
+      }
       if(item && item.type == pictureFile)
       {
          view.bitmap = Bitmap { };
@@ -1984,7 +2007,7 @@ public:
       location.GetPath(path);
       {
          FileListing listing { path };
-         
+
          ExplorerFileItem item;
          DataRow row;
 
@@ -2020,7 +2043,7 @@ public:
    FileSystemNode selection;
 
    virtual bool Window::NotifyNodeSelect(ExplorerTree tree, FileSystemNode node);
-   
+
    property FileSystemNode node
    {
       get
@@ -2108,7 +2131,7 @@ public:
          }
          return true;
       }
-      
+
       bool NotifyRightClick(ListBox listBox, int x, int y, Modifiers mods)
       {
          DataRow row = listBox.currentRow;
@@ -2129,8 +2152,8 @@ public:
                popup = PopupMenu
                   {
                      master = this, menu = menu,
-                     position = { 
-                        x + clientStart.x + absPosition.x - guiApp.desktop.position.x, 
+                     position = {
+                        x + clientStart.x + absPosition.x - guiApp.desktop.position.x,
                         y + clientStart.y + absPosition.y - guiApp.desktop.position.y }
                   };
                popup.Create();
@@ -2203,7 +2226,7 @@ public:
    MenuItem itemEditPaste
    {
       editMenu, "Paste\tCtrl+V", p;
-   
+
       bool NotifySelect(MenuItem selection, Modifiers mods)
       {
          //EditPaste();
@@ -2221,7 +2244,7 @@ public:
       }
    };
 
-   // WHY is this crashing ? 
+   // WHY is this crashing ?
    /-*void OnResize(int width, int height)
    {
       if(this && nameField)
@@ -2249,14 +2272,14 @@ public:
    #endif
       AddTreeNode(root, true, false, false, null, tree);
 
-   // How can this make sense for linux? 
+   // How can this make sense for linux?
    #ifdef __WIN32__
       while(listing.Find())
       {
          int len = strlen(listing.name);
          char info[MAX_LOCATION];
          char name[MAX_LOCATION];
-         if(listing.stats.attribs.isDrive && 
+         if(listing.stats.attribs.isDrive &&
                len > 3 && !strncmp(&listing.name[1], ": [", 3))
          {
             strncpy(name, listing.name, 2);
@@ -2309,7 +2332,7 @@ public:
             ClipBoard clipBoard { };
             if(clipBoard.Allocate(size+1))
             {
-               GetSel(clipBoard.memory, true);   
+               GetSel(clipBoard.memory, true);
                // Save clipboard
                clipBoard.Save();
             }
@@ -2358,11 +2381,11 @@ hGlobal = GlobalAlloc(GHND, Len(DF) + Len(strFiles)) 'put all files to a exclusi
 If hGlobal Then 'if the globalalloc worked
   lpGlobal = GlobalLock(hGlobal) 'lock the hGlobal
   DF.pFiles = Len(DF) 'set the size of the files
-  
+
   Call CopyMem(ByVal lpGlobal, DF, Len(DF)) 'copy df to the lpglobal
   Call CopyMem(ByVal (lpGlobal + Len(DF)), ByVal strFiles, Len(strFiles)) 'copy strfiles to lpglobal
   Call GlobalUnlock(hGlobal) 'unlock hglobal again
-  
+
   SetClipboardData CF_HDROP, hGlobal 'put files to the clipboard
 End If
 *-/
@@ -2389,7 +2412,7 @@ public:
    }
    BSloc Remove(FileSystemNode item)
    {
-      
+
    }
 }
 #endif
@@ -2438,7 +2461,7 @@ public class ExplorerFileItem : struct
       //float scale = Min((float)clientSize.w / (float)bitmap.width, (float)clientSize.h / (float)bitmap.height);
       int w = 16; //(int)(bitmap.width * scale);
       int h = 16; //(int)(bitmap.height * scale);
-   
+
       Bitmap icon;
 
       icon = control.fileIcons[type].bitmap;
@@ -2449,7 +2472,7 @@ public class ExplorerFileItem : struct
          indentSize = 8;
       }
       textOffset = indent * indentSize + (icon ? (icon.width + 6) : 0);
-      
+
       if(info)
          sprintf(label, "%s [%s]", name, info);
       else
@@ -2550,7 +2573,7 @@ public:
       {
          //_[c].Free()
          delete _[c];
-      }  
+      }
       count = 0;
       size = 0;
    }
@@ -2562,7 +2585,7 @@ ExplorerFileItem MakeFileItem(const FileAttribs attribs, const char * fileName,
    char info[MAX_LOCATION];
    char name[MAX_LOCATION];
    char extension[MAX_EXTENSION];
-   
+
    ExplorerFileItem item { };
 
    //if(stats.attribs.isFile) // -- should work now
@@ -2579,7 +2602,7 @@ ExplorerFileItem MakeFileItem(const FileAttribs attribs, const char * fileName,
          item.type = cdrom;
       if(attribs.isRemote)
          item.type = netDrive;
-      if(attribs.isRemovable) 
+      if(attribs.isRemovable)
       {
          if(fileName[0] == 'A' || fileName[0] == 'B')
             item.type = floppy;
@@ -2592,11 +2615,11 @@ ExplorerFileItem MakeFileItem(const FileAttribs attribs, const char * fileName,
       GetExtension(fileName, extension);
       //strupr(extension);
       strlwr(extension);
-      
+
       item.type = _FileType::SelectByExtension(extension);
    }
 
-   if(attribs.isDrive && 
+   if(attribs.isDrive &&
          len > 3 && !strncmp(&fileName[1], ": [", 3))
    {
       strncpy(name, fileName, 2);
@@ -2673,7 +2696,7 @@ private:
    }
 
 public:
-   /*//LinkElement<FileSystemNode> link;
+   /* LinkElement<FileSystemNode> link;
    FileSystemNode parent;
 
    FileSystemNodeType type;
@@ -2686,12 +2709,12 @@ public:
 
    property bool isListItem { set { bits.isListItem = value; } get { return bits.isListItem; } };
 
-   property char * path
+   property const char * path
    {
       set { delete path; if(value && value[0]) path = CopyString(value); }
       get { return path; } isset { return path && path[0]; }
    }
-   property char * name
+   property const char * name
    {
       set { delete name; if(value && value[0]) name = CopyString(value); }
       get { return name; } isset { return name && name[0]; }
@@ -2701,12 +2724,12 @@ public:
       set { delete extension; if(value && value[0]) extension = CopyString(value); }
       get { return extension; } isset { return extension && extension[0]; }
    }
-   property char * label
+   property const char * label
    {
       set { delete label; if(value && value[0]) label = CopyString(value); }
       get { return label; } isset { return label && label[0]; }
    }
-   property char * info
+   property const char * info
    {
       set { delete info; if(value && value[0]) info = CopyString(value); }
       get { return info; } isset { return info && info[0]; }
@@ -2726,7 +2749,7 @@ public:
    Array<int> exists; // would use (see) BoolArrayInt to pack this into an int if could be accessed as an array
 
    void GetPath(String outputPath)
-   {  
+   {
       if(path)
          strcpy(outputPath, path);
       else if(parent)
@@ -2741,17 +2764,9 @@ public:
             PathCat(temp, outputPath);
             strcpy(outputPath, temp);
          }
-         /*else
-         {
-   /-*#ifdef __WIN32__
-            strcpy(outputPath, "/");
-   #else*-/
-            //strcpy(outputPath, name);
-            strcpy(outputPath, path);
-            PathCat(outputPath, name);
-   //#endif
-         }*/
       }
+      else
+         strcpy(outputPath, name ? name : "");
    }
 
    bool IsChildOf(FileSystemNode node)
@@ -2768,7 +2783,7 @@ public:
       if(children.first)
       {
          FileSystemNode child;
-         
+
          for(child = children.first; child; child = child.next)
          {
             FileSystemNode copy { };
@@ -2782,7 +2797,7 @@ public:
          }
       }
    }
-   
+
    void EnsureVisible(bool expand)
    {
       if(parent)
@@ -2823,7 +2838,7 @@ public:
    void OnDisplay(Surface surface, int x, int y, int width, FileSystemBox fsb, Alignment alignment, DataDisplayFlags displayFlags)
    {
       //int indentSize = (displayFlags.dropBox) ? 0 : 10;
-      int indent = 16;
+      //int indent = 16;
       int xStart;
       int len;
       int w, h;
@@ -2838,8 +2853,9 @@ public:
 
       if(!this)
          return;
-      
+
       comp = fsb.comparedPaths && fsb.comparedPaths.count > 1;
+
       icon = fsb.fileIcons[type].bitmap;
       alt = bits.isListItem ? path : name;
       if(comp && !fsb.bits.columnsCompareStyle && cmpIcon)
@@ -2868,7 +2884,7 @@ public:
          strcpy(text, label ? label : alt); //"%d-%d/%s", stats.inode, stats.nlink
          //sprintf(text, "%d-%d/%s", stats.inode, stats.nlink, label ? label : alt);
       len = strlen(text);
-      
+
       if(!icon)
       {
          if(type == folder || type == folderOpen)
@@ -2877,18 +2893,17 @@ public:
          indent = 8;
       }
       //textOffset = indent * indentSize + (icon ? (icon.width + 4) : 0);
-      
+
       surface.SetForeground(displayFlags.selected ? fsb.selectionText : fsb.foreground);
       surface.TextOpacity(false);
       surface.TextExtent(text, len, &w, &h);
       h = Max(h, 16);
-    
+
       // Draw the current row stipple
       if(displayFlags.selected)
          //surface.Area(xStart - 1, y, xStart - 1, y + h - 1);
          //surface.Area(xStart + w - 1, y, xStart + w + 1, y + h - 1);
          surface.Area(xStart - 3, y, xStart + w + 1, y + h - 1);
-      
       //surface.WriteTextDots(alignment, x + textOffset, y + 2, width - textOffset, alt, strlen(alt));
       surface.WriteTextDots(alignment, xStart, y + 2, width, text, len);
 
@@ -3101,7 +3116,7 @@ public:
    //}
 #endif
 
-   bool OnGetDataFromString(char * string)
+   bool OnGetDataFromString(const char * string)
    {
 #if 0
       if(string && *string)
@@ -3115,7 +3130,7 @@ public:
       return false;
    }
 
-   char * OnGetString(char * tempString, FileSystemToolWindow fileSysToolWnd, bool * needClass)
+   const char * OnGetString(char * tempString, void * unused /*FileSystemToolWindow fileSysToolWnd*/, bool * needClass)
    {
       return name ? name : "";
    }
@@ -3134,7 +3149,7 @@ public:
       if(stats.attribs.isShare) node.type = share;
       if(stats.attribs.isCDROM) node.type = cdrom;
       if(stats.attribs.isRemote) node.type = netDrive;
-      if(stats.attribs.isRemovable) 
+      if(stats.attribs.isRemovable)
       {
          if(name[0] == 'A' || name[0] == 'B')
             node.type = floppy;
@@ -3158,13 +3173,13 @@ FileSystemNode MakeFileSystemNode(
    const bool pathAddName,
    const bool previewPicture,
    const bool isListItem,
-   const DisplaySystem displaySystem)
+   /*const */DisplaySystem displaySystem)
 {
    int len = strlen(name);
    char info[MAX_LOCATION];
    char name2[MAX_LOCATION];
    char extension[MAX_EXTENSION];
-   
+
    FileSystemNode node { stats = stats };
 
    /*if(!pathAddName)
@@ -3187,7 +3202,7 @@ FileSystemNode MakeFileSystemNode(
       if(stats.attribs.isShare) node.type = share;
       if(stats.attribs.isCDROM) node.type = cdrom;
       if(stats.attribs.isRemote) node.type = netDrive;
-      if(stats.attribs.isRemovable) 
+      if(stats.attribs.isRemovable)
       {
          if(name[0] == 'A' || name[0] == 'B')
             node.type = floppy;
@@ -3199,11 +3214,11 @@ FileSystemNode MakeFileSystemNode(
    {
       GetExtension(name, extension);
       strlwr(extension);
-      
+
       node.type = _FileType::SelectByExtension(extension);
    }
 
-   if(stats.attribs.isDrive && 
+   if(stats.attribs.isDrive &&
          len > 3 && !strncmp(&name[1], ": [", 3))
    {
       strncpy(name2, name, 2);
@@ -3219,8 +3234,8 @@ FileSystemNode MakeFileSystemNode(
 
    if(pathAddName)
    {
-      bool isFile = stats.attribs.isFile;
-      bool isFolder = stats.attribs.isDirectory;
+      //bool isFile = stats.attribs.isFile;
+      //bool isFolder = stats.attribs.isDirectory;
       char full[MAX_LOCATION];
       strcpy(full, path);
       PathCat(full, name);
@@ -3253,8 +3268,8 @@ FileSystemNode MakeComparedFileSystemNode(
    const bool previewPicture,
    const int cmpIcon,
    const bool cmpNot,
-   const Array<int> exists,
-   const DisplaySystem displaySystem)
+   /*const */Array<int> exists,
+   /*const */DisplaySystem displaySystem)
 {
    FileSystemNode node = MakeFileSystemNode(stats, name, path, pathAddName, previewPicture, false, displaySystem);
    if(node)
index 03920bd..89eeaa1 100644 (file)
@@ -132,16 +132,16 @@ public:
                iterateStartPath = true;
 
                // COMPILER TOFIX: this will not compile (error: method class must be derived from class) -- bool Whatever/*FileSystemCache*/::OnFolder(...)
-               bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(char * name, char * path, FileStats stats, bool isRootObject)
+               bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(const char * name, const char * path, FileStats stats, bool isRootObject)
                {
                   bool result = true;
                   FileSystemCache cache = this.cache;
-                  uint dev = stats.dev;
-                  uint inode = stats.inode;
+                  //uint dev = stats.dev;
+                  //uint inode = stats.inode;
                   char * p;
                   FSCacheObject parent = isRootObject ? null : cache.normalParentStack.lastIterator.data;
                   FSCacheObject o { parent, name = CopyString(isRootObject ? path : name), stats = stats };
-                  FileStats s;
+                  //FileStats s;
                   if(isRootObject)
                   {
                      // TODO see if we can find a parent for it
@@ -163,20 +163,22 @@ public:
                   }
                   cache.objects.Add(o);
 #if _DEBUG
+                  /*
                   if(cache.objects.count % 1000 == 0)
                      PrintLn(path, " ----- ", cache.objects.count / 1000, " --------- ", dev);
-                  FileGetStatsLink(path, s);
+                  */
+                  //FileGetStatsLink(path, s);
+                  /*
                   if(s.inode != inode)
                   {
                      PrintLn(s.inode);
                      PrintLn(inode);
-                     PrintLn("crap");
                   }
+                  */
                   p = o.GetPath();
                   if(strcmp(p, path))
                   {
                      int c;
-                     PrintLn("damn");
                      PrintLn(p);
                      for(c = 0; c < cache.normalParentStack.count; c++)
                      {
@@ -185,10 +187,10 @@ public:
                         PrintLn(p);
                      }
                      PrintLn(path);
-                     PrintLn("bad");
                   }
                   delete p;
 #endif
+                  /*
                   if(dev && inode && cache.bits.indexInodes)
                   {
                      FileSystemDeviceCache devCache = cache.deviceCaches[dev];
@@ -203,17 +205,18 @@ public:
                         inodes.Add(o);
                      }
                   }
+                  */
                   return result;
                }
 
-               void /*FileSystemCache*/DummyFileSystemCacheWindow::OnEnteringDirectory(char * path)
+               void /*FileSystemCache*/DummyFileSystemCacheWindow::OnEnteringDirectory(const char * path)
                {
                   FileSystemCache cache = this.cache;
                   FSCacheObject o = cache.objects.lastIterator.data;
                   cache.normalParentStack.Add(o);
                }
 
-               void /*FileSystemCache*/DummyFileSystemCacheWindow::OnLeavingDirectory(char * path)
+               void /*FileSystemCache*/DummyFileSystemCacheWindow::OnLeavingDirectory(const char * path)
                {
                   FileSystemCache cache = this.cache;
                   cache.normalParentStack.lastIterator.Remove();
@@ -310,8 +313,11 @@ public:
    void Special(char * path/*, Map<String, bool> linksPaths*//*Map<uint, Map<uint, bool>> devsInodesDone*/, DummyFileSystemCacheWindow dummyWindow)
    {
       FileSystemCacheIterator fsci { owner = dummyWindow, cache = this, iterateStartPath = true;
-         bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(char * name, char * path, FileStats stats, bool isRootObject)
+         bool /*FileSystemCache*/DummyFileSystemCacheWindow::OnObject(const char * name, const char * path,
+            FileStats stats, bool isRootObject)
          {
+                        /*
+
             uint dev = stats.dev;
             uint inode = stats.inode;
             FileSystemCache cache = this.cache;
@@ -353,6 +359,7 @@ public:
             }
             else
                PrintLn("no dev/inode");
+            */
             return true;
          }
       };
@@ -455,12 +462,12 @@ private:
    }
 }
 
-Array<String> GetPathDirNamesArray(char * path)
+Array<String> GetPathDirNamesArray(const char * path)
 {
    Array<String> names;
    if(path && path[0])
    {
-      char * p = path;
+      const char * p = path;
       char rest[MAX_LOCATION];
       char name[MAX_FILENAME];
       names = { };
index 6c2cab3..8561a54 100644 (file)
@@ -25,10 +25,10 @@ public:
       {
          char name[MAX_LOCATION] = "";
          FileStats stats;
-         if(followLinks)
+         //if(followLinks)
             FileGetStats(startPath, stats);
-         else
-            FileGetStatsLink(startPath, stats);
+         /*else
+            FileGetStatsLink(startPath, stats);*/
          GetLastDirectory(startPath, name);
          listDirEntries = OnObject(owner, name, startPath, stats, true);
          if(listDirEntries)
@@ -45,7 +45,7 @@ public:
          {
             if(frame.listing.Find())
             {
-               FileStats stats = followLinks ? frame.listing.stats : frame.listing.lstats;
+               FileStats stats = /*followLinks ? */frame.listing.stats /*: frame.listing.lstats*/;
                listDirEntries = OnObject(owner, frame.listing.name, frame.listing.path, stats, !iterateStartPath && stack.count == 1);
                if(stats.attribs.isDirectory)
                {
@@ -101,18 +101,20 @@ public:
    bool iterateStartPath;
 
    virtual bool Iterate(char * startPath, bool followLinks);
-   virtual bool any_object::OnObject(/*any_object data, */char * name, char * path, FileStats stats, bool isRootObject);
-   virtual void any_object::OnEnteringDirectory(/*any_object data, */char * path);
-   virtual void any_object::OnLeavingDirectory(/*any_object data, */char * path);
+   virtual bool any_object::OnObject(/*any_object data, */const char * name, const char * path, FileStats stats, bool isRootObject);
+   virtual void any_object::OnEnteringDirectory(/*any_object data, */const char * path);
+   virtual void any_object::OnLeavingDirectory(/*any_object data, */const char * path);
 
 private:
 }
 
 // TODO: implement threaded iteration somehow....
+/*
 static class IteratorThread : Thread
 {
    void Temp()
    {
-      //listing = FileListing { dir, extensions = filter.extensions };  // there should be a sorted = true/false 
+      //listing = FileListing { dir, extensions = filter.extensions };  // there should be a sorted = true/false
    }
 }
+*/
index 690cd71..d198f1b 100644 (file)
@@ -12,7 +12,7 @@ struct SearchStackFrame
    int tag;
    char path[MAX_LOCATION];
    FileListing listing;
-   
+
    bool branched;
    //DataRow result;
    //DataRow browse;
@@ -47,7 +47,7 @@ public:
       terminate = false;
    }
 
-   virtual bool Window::NotifyUpdateSearchLocation(FileSystemSearch search, char * location);
+   virtual bool Window::NotifyUpdateSearchLocation(FileSystemSearch search, const char * location);
    virtual bool Window::NotifySearchSortResults(FileSystemSearch search);
    virtual bool Window::NotifySearchSortBrowser(FileSystemSearch search);
    virtual bool Window::NotifySearchTerminated(FileSystemSearch search);
@@ -61,7 +61,7 @@ public:
 
 
 
-   bool SearchFileContent(String path)
+   bool SearchFileContent(const String path)
    {
       bool match = false;
       File file = FileOpen(path, read);
@@ -96,8 +96,8 @@ public:
                      find = SearchString(buffer, start, contentSearch, optionContentMatchCase, optionContentMatchWord);
 
                      // todo add a maximum line length possibility as param
-                     for(bstart = start; 
-                           bstart < readCount && newLine && (!find || newLine < find); 
+                     for(bstart = start;
+                           bstart < readCount && newLine && (!find || newLine < find);
                               bstart += (newLine - &buffer[bstart]) / sizeof(char))
                      {
                         newLine = strstr(&buffer[bstart], "\n");
@@ -131,14 +131,14 @@ public:
                      find = SearchString(buffer, start, contentSearch, optionContentMatchCase, optionContentMatchWord);
                file.Seek(seekBack, current);
             }
-            match = (bool)find;
+            match = find != null;
          }
          delete file;
       }
       return match;
    }
-   
-   // I wonder if this is optimized at the c level to be compiled inline 
+
+   // I wonder if this is optimized at the c level to be compiled inline
    // and to use in-place in-stack memory for both the return value and the parameters
    // if not, c should be more optimized...
    // would the const have any impact on optimization?
@@ -155,24 +155,24 @@ public:
       // \\Nateus\data\ is not remote, etc...
       // How to?
       FileStats stats;
-      
+
       terminate = false;
       count = 0;
       matchCount = 0;
-      
+
       hasNameSearch = (strlen(nameSearch) != 0);
       hasSizeSearch = false;  // this is temporary
       hasContentSearch = (strlen(contentSearch) != 0);
 
       listLines = true;
       lines = OldList { };
-      
+
       //SearchDir(location);
 
       FileGetStats(location, stats);
 
       strcpy(stack[0].path, location);
-      stack[0].listing = FileListing { stack[0].path };  // there should be a sorted = true/false 
+      stack[0].listing = FileListing { stack[0].path };  // there should be a sorted = true/false
 
       //fsb.list.Clear();
                                                          // Binary Search sorting...
@@ -198,7 +198,7 @@ public:
          }
          guiApp.Unlock();
       }
-      
+
       for(frame = 0; frame >= 0 && !terminate; )
       {
          guiApp.Lock();
@@ -222,13 +222,13 @@ public:
          if(stack[frame].listing.Find())
          {
             count++;
-            
+
             //match = (strcmp(stack[frame].listing.name, nameSearch) == 0);
             //match = (stack[frame].listing.name[0] == nameSearch[0]);
             //match = (bool)strstr(stack[frame].listing.name, nameSearch);
-               
+
             if(hasNameSearch)
-               match = (bool)SearchString(stack[frame].listing.name, 0, nameSearch, optionNameMatchCase, optionNameMatchWord);
+               match = SearchString(stack[frame].listing.name, 0, nameSearch, optionNameMatchCase, optionNameMatchWord) != null;
             else
                match = true;