Repository: spyder-ide/spyder

Issue:
Creating a new project makes the path with mixed slashes
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description

Happens when you select a different `Location`
![imagen](https://user-images.githubusercontent.com/16781833/43031092-7e5cd136-8c60-11e8-9312-7b13192ba9f0.png)


### What steps reproduce the problem?

1. Select a different `Location` from the project creation dialog
2. Type a name for the project

### What is the expected output? What do you see instead?

A proper path and not mixed slashes

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 3.2.8
* Python version: 3.6.4
* Qt version: 5.6.2
* PyQt version: 5
* Operating System name/version: Windows

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->
IPython >=4.0    :  6.2.1 (OK)
cython >=0.21    :  None (NOK)
jedi >=0.9.0     :  0.11.1 (OK)
nbconvert >=4.0  :  5.3.1 (OK)
numpy >=1.7      :  1.14.1 (OK)
pandas >=0.13.1  :  0.23.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pyflakes >=0.6.0 :  1.6.0 (OK)
pygments >=2.0   :  2.2.0 (OK)
pylint >=0.25    :  1.8.2 (OK)
qtconsole >=4.2.0:  4.3.1 (OK)
rope >=0.9.4     :  0.10.7 (OK)
sphinx >=0.6.6   :  1.7.5 (OK)
sympy >=0.7.3    :  None (NOK)





Discussion:
Can I work on this one?
Sure, please go ahead @vitoriahmc! It shouldn't be that hard to solve.
@vitoriahmc Do ask if you could use some help

Resolving patch:
diff --git a/spyder/plugins/projects/widgets/projectdialog.py b/spyder/plugins/projects/widgets/projectdialog.py
--- a/spyder/plugins/projects/widgets/projectdialog.py
+++ b/spyder/plugins/projects/widgets/projectdialog.py
@@ -152,8 +152,10 @@ def _get_project_types(self):
 
     def select_location(self):
         """Select directory."""
-        location = getexistingdirectory(self, _("Select directory"),
-                                        self.location)
+        location = osp.normpath(getexistingdirectory(self,
+                                                     _("Select directory"),
+                                                     self.location))
+
         if location:
             if is_writable(location):
                 self.location = location


Test patch:
diff --git a/spyder/plugins/projects/widgets/tests/test_projectdialog.py b/spyder/plugins/projects/widgets/tests/test_projectdialog.py
--- a/spyder/plugins/projects/widgets/tests/test_projectdialog.py
+++ b/spyder/plugins/projects/widgets/tests/test_projectdialog.py
@@ -8,12 +8,20 @@
 Tests for projectdialog.py
 """
 
-# Test library imports
+# Standard library imports
+import os
+try:
+    from unittest.mock import Mock
+except ImportError:
+    from mock import Mock  # Python 2
+
+# Third party imports
 import pytest
 
 # Local imports
 from spyder.plugins.projects.widgets.projectdialog import ProjectDialog
 
+
 @pytest.fixture
 def setup_projects_dialog(qtbot):
     """Set up ProjectDialog."""
@@ -28,5 +36,42 @@ def test_project_dialog(qtbot):
     assert dlg
 
 
+@pytest.mark.skipif(os.name != 'nt', reason="Specific to Windows platform")
+def test_projectdialog_location(monkeypatch):
+    """Test that select_location normalizes delimiters and updates the path."""
+    dlg = ProjectDialog(None)
+    mock_getexistingdirectory = Mock()
+    monkeypatch.setattr('spyder.plugins.projects.widgets.projectdialog' +
+                        '.getexistingdirectory', mock_getexistingdirectory)
+
+    mock_getexistingdirectory.return_value = r"c:\a/b\\c/d"
+    dlg.select_location()
+    assert dlg.location == r"c:\a\b\c\d"
+
+    mock_getexistingdirectory.return_value = r"c:\\a//b\\c//d"
+    dlg.select_location()
+    assert dlg.location == r"c:\a\b\c\d"
+
+    mock_getexistingdirectory.return_value = r"c:\a\b\c/d"
+    dlg.select_location()
+    assert dlg.location == r"c:\a\b\c\d"
+
+    mock_getexistingdirectory.return_value = r"c:/a/b/c\d"
+    dlg.select_location()
+    assert dlg.location == r"c:\a\b\c\d"
+
+    mock_getexistingdirectory.return_value = r"c:\\a\\b\\c//d"
+    dlg.select_location()
+    assert dlg.location == r"c:\a\b\c\d"
+
+    mock_getexistingdirectory.return_value = r"c:\AaA/bBB1\\c-C/d2D"
+    dlg.select_location()
+    assert dlg.location == r"c:\AaA\bBB1\c-C\d2D"
+
+    mock_getexistingdirectory.return_value = r"c:\\a_a_1//Bbbb\2345//d-6D"
+    dlg.select_location()
+    assert dlg.location == r"c:\a_a_1\Bbbb\2345\d-6D"
+
+
 if __name__ == "__main__":
     pytest.main()