Index: visual_studio/NativeClientVSAddIn/InstallerResources/create_ppapi_platform.py |
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/create_ppapi_platform.py b/visual_studio/NativeClientVSAddIn/InstallerResources/create_ppapi_platform.py |
index c238009f5b30f2b60fb032b60cedebae61d70351..fe9e028d929c6b3615e6da4bfe9f94790fb16d7b 100644 |
--- a/visual_studio/NativeClientVSAddIn/InstallerResources/create_ppapi_platform.py |
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/create_ppapi_platform.py |
@@ -17,6 +17,9 @@ import string |
import xml_patch |
import xml.etree.ElementTree |
+ |
+PEPPER_PLATFORM_NAME = 'PPAPI' |
+ |
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
PLATFORM_FILES = [ |
@@ -137,16 +140,26 @@ def FixAttributesNamespace(tree): |
elem.attrib = new_attrib |
-def main(): |
- install_dir = os.path.expandvars( |
- '%ProgramFiles(x86)%\\MSBuild\\Microsoft.Cpp\\v4.0\\Platforms') |
+def CreatePPAPI(msbuild_dir): |
+ """Creates the PPAPI template. |
+ |
+ Args: |
+ msbuild_dir: The path to the MSBuild installation. |
+ |
+ Returns: |
+ Nothing. |
+ |
+ Raises: |
+ Exception indicating Win32 platform was not found. |
+ """ |
+ |
+ install_dir = os.path.join(msbuild_dir, 'Microsoft.Cpp\\v4.0\\Platforms') |
# Note 1033 is code for the english language. |
- ui_xml_dir = os.path.expandvars( |
- '%ProgramFiles(x86)%\\MSBuild\\Microsoft.Cpp\\v4.0\\1033') |
+ ui_xml_dir = os.path.join(msbuild_dir, 'Microsoft.Cpp\\v4.0\\1033') |
win32_dir = os.path.join(install_dir, 'Win32') |
- ppapi_dir = os.path.join(install_dir, 'PPAPI') |
+ ppapi_dir = os.path.join(install_dir, PEPPER_PLATFORM_NAME) |
patch_dir = os.path.join(SCRIPT_DIR, 'PPAPI_Patch') |
if not os.path.exists(win32_dir): |
@@ -176,5 +189,13 @@ def main(): |
os.path.join(ppapi_dir, 'Microsoft.Build.CPPTasks.PPAPI.dll')) |
+def main(argv): |
+ # Optionally pass in MS Build installation directory. |
binji
2012/07/26 23:32:17
now that you have args, you should really add optp
tysand
2012/07/28 01:13:11
Done.
|
+ if len(argv) > 1: |
+ msbuild_dir = argv[1] |
+ else: |
+ msbuild_dir = os.path.expandvars('%ProgramFiles(x86)%\\MSBuild') |
+ CreatePPAPI(msbuild_dir) |
+ |
if __name__ == '__main__': |
- main() |
+ main(sys.argv) |