1 package org.codehaus.mojo.natives.msvc;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 import java.io.File;
28 import java.util.HashMap;
29 import java.util.Map;
30
31 import org.codehaus.mojo.natives.NativeBuildException;
32 import org.codehaus.mojo.natives.util.EnvUtil;
33
34
35
36
37
38 public class MSVC2003ToolkitEnvFactory
39 extends AbstractMSVCEnvFactory
40 {
41 private static final String MSVC2003_TOOLKIT_INSTALL_ENV_KEY = "MSVC2003_TOOLKIT_INSTALL_DIR";
42
43 private static final String DEFAULT_MSVC2003_TOOLKT_INSTALL_DIR = getProgramFiles()
44 + "/Microsoft Visual C++ Toolkit 2003";
45
46 protected Map createEnvs()
47 throws NativeBuildException
48 {
49 File vcInstallDir =
50 new File( EnvUtil.getEnv( MSVC2003_TOOLKIT_INSTALL_ENV_KEY, MSVC2003_TOOLKIT_INSTALL_ENV_KEY,
51 DEFAULT_MSVC2003_TOOLKT_INSTALL_DIR ) );
52
53 if ( !vcInstallDir.isDirectory() )
54 {
55 throw new NativeBuildException( vcInstallDir.getPath() + " is not a directory." );
56 }
57
58 Map envs = new HashMap();
59
60
61 String currentPath = System.getProperty( "java.library.path" );
62
63 String newPath = vcInstallDir.getPath() + "\\BIN;" + currentPath;
64
65 envs.put( "PATH", newPath );
66
67
68 String currentIncludePath = EnvUtil.getEnv( "INCLUDE" );
69
70 String newIncludePath = vcInstallDir.getPath() + "\\INCLUDE;" + currentIncludePath;
71
72 envs.put( "INCLUDE", newIncludePath );
73
74
75
76
77 String currentLibPath = EnvUtil.getEnv( "LIB" );
78
79 String newLibPath = vcInstallDir.getPath() + "\\LIB;" + currentLibPath;
80
81 envs.put( "LIB", newLibPath );
82
83 return envs;
84
85 }
86
87 }