3760 @return flag indicating membership |
3760 @return flag indicating membership |
3761 @rtype bool |
3761 @rtype bool |
3762 """ |
3762 """ |
3763 newfn = os.path.abspath(fn) |
3763 newfn = os.path.abspath(fn) |
3764 newfn = self.getRelativePath(newfn) |
3764 newfn = self.getRelativePath(newfn) |
3765 for group in ["SOURCES", "FORMS", "INTERFACES", "PROTOCOLS", |
3765 return any( |
3766 "RESOURCES", "TRANSLATIONS", "OTHERS"]: |
3766 newfn in self.pdata[group] |
3767 if newfn in self.pdata[group]: |
3767 for group in [ |
3768 return True |
3768 "SOURCES", "FORMS", "INTERFACES", "PROTOCOLS", "RESOURCES", |
3769 return False |
3769 "TRANSLATIONS", "OTHERS" |
|
3770 ] |
|
3771 ) |
3770 |
3772 |
3771 def isProjectFile(self, fn): |
3773 def isProjectFile(self, fn): |
3772 """ |
3774 """ |
3773 Public method used to check, if the passed in filename belongs to the |
3775 Public method used to check, if the passed in filename belongs to the |
3774 project. |
3776 project. |
3775 |
3777 |
3776 @param fn filename to be checked (string) |
3778 @param fn filename to be checked (string) |
3777 @return flag indicating membership (boolean) |
3779 @return flag indicating membership (boolean) |
3778 """ |
3780 """ |
3779 for group in ["SOURCES", "FORMS", "INTERFACES", "PROTOCOLS", |
3781 return any( |
3780 "RESOURCES", "TRANSLATIONS", "OTHERS"]: |
3782 self.__checkProjectFileGroup(fn, group) |
3781 if self.__checkProjectFileGroup(fn, group): |
3783 for group in [ |
3782 return True |
3784 "SOURCES", "FORMS", "INTERFACES", "PROTOCOLS", "RESOURCES", |
3783 |
3785 "TRANSLATIONS", "OTHERS" |
3784 return False |
3786 ] |
|
3787 ) |
3785 |
3788 |
3786 def __checkProjectFileGroup(self, fn, group): |
3789 def __checkProjectFileGroup(self, fn, group): |
3787 """ |
3790 """ |
3788 Private method to check, if a file is in a specific file group of the |
3791 Private method to check, if a file is in a specific file group of the |
3789 project. |
3792 project. |
3795 newfn = os.path.abspath(fn) |
3798 newfn = os.path.abspath(fn) |
3796 newfn = self.getRelativePath(newfn) |
3799 newfn = self.getRelativePath(newfn) |
3797 if newfn in self.pdata[group]: |
3800 if newfn in self.pdata[group]: |
3798 return True |
3801 return True |
3799 elif group == "OTHERS": |
3802 elif group == "OTHERS": |
3800 for entry in self.pdata[group]: |
3803 if any(newfn.startswith(entry) for entry in self.pdata[group]): |
3801 if newfn.startswith(entry): |
3804 return True |
3802 return True |
|
3803 |
3805 |
3804 if Utilities.isWindowsPlatform(): |
3806 if Utilities.isWindowsPlatform(): |
3805 # try the above case-insensitive |
3807 # try the above case-insensitive |
3806 newfn = newfn.lower() |
3808 newfn = newfn.lower() |
3807 for entry in self.pdata[group]: |
3809 if any(entry.lower() == newfn for entry in self.pdata[group]): |
3808 if entry.lower() == newfn: |
3810 return True |
3809 return True |
|
3810 elif group == "OTHERS": |
3811 elif group == "OTHERS": |
3811 for entry in self.pdata[group]: |
3812 if any(newfn.startswith(entry.lower()) |
3812 if newfn.startswith(entry.lower()): |
3813 for entry in self.pdata[group]): |
3813 return True |
3814 return True |
3814 |
3815 |
3815 return False |
3816 return False |
3816 |
3817 |
3817 def isProjectSource(self, fn): |
3818 def isProjectSource(self, fn): |
3818 """ |
3819 """ |