summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool/msvs.py
diff options
context:
space:
mode:
authorstopiccot <devnull@localhost>2012-02-12 12:37:34 (GMT)
committerstopiccot <devnull@localhost>2012-02-12 12:37:34 (GMT)
commit7db7f301f6b29b9e739b632535cb138a5d146121 (patch)
tree8bd9aeef8d2f6f697bf1bd66530701f3947b0084 /src/engine/SCons/Tool/msvs.py
parentf6e68423b7d7a8173bc8868b982e57a11826f51e (diff)
downloadSCons-7db7f301f6b29b9e739b632535cb138a5d146121.zip
SCons-7db7f301f6b29b9e739b632535cb138a5d146121.tar.gz
SCons-7db7f301f6b29b9e739b632535cb138a5d146121.tar.bz2
Fix in Visual Studio project generation. When project contains only one *.cpp or only one *.h file, incorrect paths are generated.
Diffstat (limited to 'src/engine/SCons/Tool/msvs.py')
-rw-r--r--src/engine/SCons/Tool/msvs.py66
1 files changed, 27 insertions, 39 deletions
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py
index 6c273a7..4077324 100644
--- a/src/engine/SCons/Tool/msvs.py
+++ b/src/engine/SCons/Tool/msvs.py
@@ -786,19 +786,15 @@ class _GenerateV7DSP(_DSPGenerator):
# First remove any common prefix
commonprefix = None
- if len(sources) > 1:
- s = list(map(os.path.normpath, sources))
- # take the dirname because the prefix may include parts
- # of the filenames (e.g. if you have 'dir\abcd' and
- # 'dir\acde' then the cp will be 'dir\a' )
- cp = os.path.dirname( os.path.commonprefix(s) )
- if cp and s[0][len(cp)] == os.sep:
- # +1 because the filename starts after the separator
- sources = [s[len(cp)+1:] for s in sources]
- commonprefix = cp
- elif len(sources) == 1:
- commonprefix = os.path.dirname( sources[0] )
- sources[0] = os.path.basename( sources[0] )
+ s = list(map(os.path.normpath, sources))
+ # take the dirname because the prefix may include parts
+ # of the filenames (e.g. if you have 'dir\abcd' and
+ # 'dir\acde' then the cp will be 'dir\a' )
+ cp = os.path.dirname( os.path.commonprefix(s) )
+ if cp and s[0][len(cp)] == os.sep:
+ # +1 because the filename starts after the separator
+ sources = [s[len(cp)+1:] for s in sources]
+ commonprefix = cp
hierarchy = makeHierarchy(sources)
self.printSources(hierarchy, commonprefix=commonprefix)
@@ -1116,19 +1112,15 @@ class _GenerateV10DSP(_DSPGenerator):
# First remove any common prefix
sources = self.sources[kind]
commonprefix = None
- if len(sources) > 1:
- s = list(map(os.path.normpath, sources))
- # take the dirname because the prefix may include parts
- # of the filenames (e.g. if you have 'dir\abcd' and
- # 'dir\acde' then the cp will be 'dir\a' )
- cp = os.path.dirname( os.path.commonprefix(s) )
- if cp and s[0][len(cp)] == os.sep:
- # +1 because the filename starts after the separator
- sources = [s[len(cp)+1:] for s in sources]
- commonprefix = cp
- elif len(sources) == 1:
- commonprefix = os.path.dirname( sources[0] )
- sources[0] = os.path.basename( sources[0] )
+ s = list(map(os.path.normpath, sources))
+ # take the dirname because the prefix may include parts
+ # of the filenames (e.g. if you have 'dir\abcd' and
+ # 'dir\acde' then the cp will be 'dir\a' )
+ cp = os.path.dirname( os.path.commonprefix(s) )
+ if cp and s[0][len(cp)] == os.sep:
+ # +1 because the filename starts after the separator
+ sources = [s[len(cp)+1:] for s in sources]
+ commonprefix = cp
hierarchy = makeHierarchy(sources)
self.printFilters(hierarchy, kind)
@@ -1143,19 +1135,15 @@ class _GenerateV10DSP(_DSPGenerator):
# First remove any common prefix
sources = self.sources[kind]
commonprefix = None
- if len(sources) > 1:
- s = list(map(os.path.normpath, sources))
- # take the dirname because the prefix may include parts
- # of the filenames (e.g. if you have 'dir\abcd' and
- # 'dir\acde' then the cp will be 'dir\a' )
- cp = os.path.dirname( os.path.commonprefix(s) )
- if cp and s[0][len(cp)] == os.sep:
- # +1 because the filename starts after the separator
- sources = [s[len(cp)+1:] for s in sources]
- commonprefix = cp
- elif len(sources) == 1:
- commonprefix = os.path.dirname( sources[0] )
- sources[0] = os.path.basename( sources[0] )
+ s = list(map(os.path.normpath, sources))
+ # take the dirname because the prefix may include parts
+ # of the filenames (e.g. if you have 'dir\abcd' and
+ # 'dir\acde' then the cp will be 'dir\a' )
+ cp = os.path.dirname( os.path.commonprefix(s) )
+ if cp and s[0][len(cp)] == os.sep:
+ # +1 because the filename starts after the separator
+ sources = [s[len(cp)+1:] for s in sources]
+ commonprefix = cp
hierarchy = makeHierarchy(sources)
self.printSources(hierarchy, kind, commonprefix, kind)