--- a/Project/Project.py Fri Jan 07 12:38:39 2011 +0100 +++ b/Project/Project.py Sun Jan 09 16:15:38 2011 +0100 @@ -574,6 +574,19 @@ self.pdata[index].remove(file) self.setDirty(True) + def __makePpathRe(self): + """ + Private method to generate a regular expression for the project path. + """ + ppathRe = (self.ppath + os.sep)\ + .replace("\\","@@")\ + .replace("/","@@")\ + .replace("@@",r"[\\/]") + if Utilities.isWindowsPlatform(): + self.ppathRe = re.compile(ppathRe, re.IGNORECASE) + else: + self.ppathRe = re.compile(ppathRe) + def __readProject(self, fn): """ Private method to read in a project (.e4p) file. @@ -597,10 +610,7 @@ self.pfile = os.path.abspath(fn) self.ppath = os.path.abspath(os.path.dirname(fn)) - if Utilities.isWindowsPlatform(): - self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE) - else: - self.ppathRe = re.compile(re.escape(self.ppath + os.sep)) + self.__makePpathRe() # insert filename into list of recently opened projects self.__syncRecent() @@ -686,10 +696,7 @@ if res: self.pfile = os.path.abspath(fn) self.ppath = os.path.abspath(os.path.dirname(fn)) - if Utilities.isWindowsPlatform(): - self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE) - else: - self.ppathRe = re.compile(re.escape(self.ppath + os.sep)) + self.__makePpathRe() self.name = os.path.splitext(os.path.basename(fn))[0] self.setDirty(False) @@ -1775,10 +1782,7 @@ if dlg.exec_() == QDialog.Accepted: self.closeProject() dlg.storeData() - if Utilities.isWindowsPlatform(): - self.ppathRe = re.compile(re.escape(self.ppath + os.sep), re.IGNORECASE) - else: - self.ppathRe = re.compile(re.escape(self.ppath + os.sep)) + self.__makePpathRe() self.pdata["VCS"] = ['None'] self.opened = True if not self.pdata["FILETYPES"]: