making paths windows friendly

This commit is contained in:
Dan Cuellar
2013-09-29 09:17:06 -07:00
parent 39773cfc7a
commit 32018ba6b0

View File

@@ -26,8 +26,7 @@ module.exports.startAppium = function(appName, verbose, readyCb, doneCb) {
var app;
if (appName) {
app = (fs.existsSync(appName)) ? appName:
path.resolve(__dirname,
"./sample-code/apps/"+appName+"/build/Release-iphonesimulator/"+appName+".app");
path.resolve(__dirname, "sample-code", "apps", appName, "build", "Release-iphonesimulator", appName + ".app");
} else {
app = null;
}
@@ -146,7 +145,7 @@ module.exports.setDeviceConfigVer = function(grunt, device, cb) {
};
module.exports.writeConfigKey = function(grunt, key, value, cb) {
var configPath = path.resolve(__dirname, '.appiumconfig');
var configPath = path.resolve(__dirname, ".appiumconfig");
fs.readFile(configPath, function(err, data) {
var writeConfig = function(config) {
config[key] = value;
@@ -272,7 +271,7 @@ module.exports.build = function(appRoot, cb, sdk) {
};
module.exports.buildApp = function(appDir, cb, sdk) {
var appRoot = path.resolve(__dirname, 'sample-code/apps/', appDir);
var appRoot = path.resolve(__dirname, "sample-code", "apps", appDir);
module.exports.build(appRoot, function(err) {
if (err !== null) {
console.log(err);
@@ -284,8 +283,8 @@ module.exports.buildApp = function(appDir, cb, sdk) {
};
module.exports.signApp = function(appName, certName, cb) {
var appPath = path.resolve(__dirname, 'sample-code/apps/', appName,
'build/Release-iphonesimulator');
var appPath = path.resolve(__dirname, "sample-code", "apps", appName,
"build", "Release-iphonesimulator");
exec("codesign -f -s \"" + certName + "\" -v " + appName + ".app", {cwd: appPath, maxBuffer: MAX_BUFFER_SIZE}, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
@@ -332,15 +331,15 @@ module.exports.setupAndroidBootstrap = function(grunt, cb) {
};
module.exports.setupAndroidApp = function(grunt, appName, cb) {
var appPath = path.resolve(__dirname, "sample-code/apps/" + appName);
var appPath = path.resolve(__dirname, "sample-code", "apps", appName);
var args = ["update", "project", "--subprojects", "-t", "android-18", "-p", "."];
setupAndroidProj(grunt, appPath, args, cb);
};
var buildAndroidProj = function(grunt, projPath, target, cb) {
var cmdName = 'ant';
if (!fs.existsSync(path.resolve(projPath, 'build.xml')) &&
fs.existsSync(path.resolve(projPath, 'pom.xml'))) {
if (!fs.existsSync(path.resolve(projPath, "build.xml")) &&
fs.existsSync(path.resolve(projPath, "pom.xml"))) {
cmdName = 'mvn';
}
var whichCmd = 'which ';
@@ -506,12 +505,12 @@ var getSelendroidVersion = function(cb) {
};
module.exports.buildAndroidApp = function(grunt, appName, cb) {
var appPath = path.resolve(__dirname, "sample-code/apps/" + appName);
var appPath = path.resolve(__dirname, "sample-code", "apps", appName);
buildAndroidProj(grunt, appPath, "debug", cb);
};
module.exports.buildSelendroidAndroidApp = function(grunt, appName, cb) {
var appPath = path.resolve(__dirname, "sample-code/apps/" + appName);
var appPath = path.resolve(__dirname, "sample-code", "apps" + appName);
buildAndroidProj(grunt, appPath, "package", cb);
};
@@ -524,7 +523,7 @@ module.exports.installAndroidApp = function(grunt, appName, cb) {
grunt.fatal(new Error(msg));
}
var appPath = path.resolve(__dirname, "sample-code/apps/" + appName,
var appPath = path.resolve(__dirname, "sample-code", "apps", appName,
"bin/" + appName + "-debug.apk");
exec("adb uninstall " + pkgMap[appName], { maxBuffer: MAX_BUFFER_SIZE }, function(err, stdout) {
if (err) return grunt.fatal(err);
@@ -578,7 +577,7 @@ module.exports.generateAppiumIo = function(grunt, cb) {
, sidebarHtml = generateSidebarHtml(headers)
, warning = "<!-- THIS FILE IS AUTOMATICALLY GENERATED DO NOT EDIT -->\n"
, bodyHtml = generateBodyHtml(readmeLex, headers)
, submod = path.resolve(__dirname, "submodules/appium.io")
, submod = path.resolve(__dirname, "submodules", "appium.io")
, outfile = submod + "/getting-started.html";
var newDoc = template.replace("{{ SIDENAV }}", sidebarHtml)
@@ -613,7 +612,7 @@ module.exports.generateAppiumIo = function(grunt, cb) {
};
var getAppiumIoFiles = function(cb) {
var templateFile = path.resolve(__dirname, "submodules/appium.io/getting-started-template.html")
var templateFile = path.resolve(__dirname, "submodules", "appium.io", "getting-started-template.html")
, readmeFile = path.resolve(__dirname, "README.md");
fs.readFile(templateFile, function(err, templateData) {