1 if (environment['xdc.hostOS'] == undefined) {
2 environment["xdc.hostOS"] = java.lang.System.getProperty("os.name") + "";
3 if (environment["xdc.hostOS"].match(/^Windows/i)) {
4 environment["xdc.hostOS"] = "Windows";
5 }
6 }
8 var fileModule = xdc.module('xdc.services.io.File');
9 var fileName = "tempcfg.bat";
10 var Mode = "w";
11 var openedFile = fileModule.open(fileName, Mode);
13 if (openedFile == undefined) {
14 print ("Unable to create "+ fileName+", Please check your write Permission");
15 java.lang.System.exit(2);
16 }
18 /* Config.bld Path */
19 var path = xdc.findFile("ti/mas/swtools");
20 if (path) {
21 /* print path */
22 path=path.toString().replace(/\\/g, "/");
23 var command="set XDCBUILDCFG="+ fileModule.getDOSPath(path)+"/config.bld";
24 openedFile.writeLine(command+"\n");
25 openedFile.writeLine("");
26 command="set SWTOOLS_DIR="+ fileModule.getDOSPath(path);
27 openedFile.writeLine(command+"\n");
28 openedFile.writeLine("");
29 }
30 else {
31 print(" Error: config.bld not found in swtools directory");
32 java.lang.System.exit(1);
33 }
35 /* Root of TI folder */
36 var path = xdc.findFile(".\\..");
37 var abspath = path.split("\\ti");
39 if (path) {
40 var command = "set INCDIR="+fileModule.getDOSPath(abspath[0].toString().replace(/\\/g,"/"));
41 openedFile.writeLine (command + "\n");
42 openedFile.writeLine ("");
43 var command = "set XDCPATH=%XDCPATH%;"+fileModule.getDOSPath(abspath[0].toString().replace(/\\/g,"/"));
44 openedFile.writeLine (command + "\n");
45 openedFile.writeLine ("");
46 var command = "set DSPLIB_INSTALL_DIR="+fileModule.getDOSPath(abspath[0].toString().replace(/\\/g,"/"));
47 openedFile.writeLine (command + "\n");
48 openedFile.writeLine ("");
49 }
51 /* Set GIT path */
52 var pathFile = fileModule.open("path.txt", "r");
53 var paths=pathFile.readLine();
54 paths=paths.toString().split(";");
55 var gitPath="";
56 for each (var path in paths)
57 {
58 if(path.toString().toLowerCase().match("git"))
59 {
60 path=path.toString().replace(/\r/g,"");
61 path=path.toString().replace(/\n/g,"");
62 gitPath=path;
63 break;
64 }
66 }
67 if (gitPath) {
68 /* print path */
70 var command="set PATH=%PATH%;"+ gitPath+"\;";
71 openedFile.writeLine(command+"\n");
72 openedFile.writeLine("");
73 }
76 pathFile.close();
77 openedFile.close()