ide; (#1057) fix import folder file dialog not pointing to project directory.
authorRejean Loyer <redj@ecere.com>
Sat, 8 Feb 2014 18:17:55 +0000 (13:17 -0500)
committerJerome St-Louis <jerome@ecere.com>
Mon, 10 Feb 2014 21:58:44 +0000 (04:58 +0700)
ide/src/project/ProjectView.ec

index 294b130..4036527 100644 (file)
@@ -2041,11 +2041,28 @@ class ProjectView : Window
    {
       if(toNode)
       {
-         //bool isFolder = toNode.type == folder;
-         //bool isRes = toNode.isInResources;
-
+         char path[MAX_LOCATION];
+         char currentDir[MAX_LOCATION];
+         ProjectNode node = toNode;
          FileDialog fileDialog = importFileDialog;
          fileDialog.master = parent;
+         while(node)
+         {
+            node.GetFullFilePath(path);
+            while(path[0])
+            {
+               StripLastDirectory(path, path);
+               if(FileExists(path).isDirectory) break;
+            }
+            if(path[0] || node == toNode.project.topNode)
+               node = null;
+            else
+               node = toNode.project.topNode;
+         }
+         MakeSystemPath(path);
+         StripLastDirectory(path, currentDir);
+         fileDialog.currentDirectory = currentDir[0] ? currentDir : path;
+         fileDialog.filePath = path;
          if(fileDialog.Modal() == ok)
          {
             ImportFolderFSI fsi { projectView = this };