Skip to content

Commit

Permalink
Merge pull request #49 from AndrewFerr/aferrazz_dev
Browse files Browse the repository at this point in the history
Prevent duplicate path names in a project's PYTHONPATH when creating src...
  • Loading branch information
fabioz committed Aug 15, 2013
2 parents 82d5d3b + fe16246 commit 2ab9669
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion plugins/org.python.pydev.debug/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@

</extension>

<!--- launcher pop up over a python file -->
<!--- launcher pop up over a python file -->
<extension point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
package org.python.pydev.ui.wizards.files;

import java.util.SortedSet;
import java.util.TreeSet;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
Expand Down Expand Up @@ -89,7 +92,11 @@ protected IFile doCreateNew(IProgressMonitor monitor) throws CoreException {
}
if (curr.length() > 0) {
//there is already some path
curr += "|" + newPath;
SortedSet<String> projectSourcePathSet = new TreeSet<String>(pathNature.getProjectSourcePathSet(true));
if (!projectSourcePathSet.contains(newPath)) {
//only add to the path if it doesn't already contain the new path
curr += "|" + newPath;
}
} else {
//there is still no other path
curr = newPath;
Expand Down

0 comments on commit 2ab9669

Please sign in to comment.