summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorstopiccot <devnull@localhost>2012-02-12 15:37:34 +0300
committerstopiccot <devnull@localhost>2012-02-12 15:37:34 +0300
commit343e936abc78e3332bebd0b423a96e017359ee13 (patch)
tree8bd9aeef8d2f6f697bf1bd66530701f3947b0084 /src
parent5fee8b80079971ad70c33a32f7e5e535e9e4db0b (diff)
downloadscons-343e936abc78e3332bebd0b423a96e017359ee13.tar.gz
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')
-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 6c273a7d..40773247 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)