alunny / node-xcode

tools and utilities for working with xcode/ios projects
Apache License 2.0
226 stars 105 forks source link

pbxProject.js replace \ to / . create file will been incorrect on windows. #83

Open wsh-justep opened 8 years ago

wsh-justep commented 8 years ago

function searchPathForFile(file, proj) { var plugins = proj.pbxGroupByName('Plugins'), pluginsPath = plugins ? plugins.path : null, fileDir = path.dirname(file.path);

if (fileDir == '.') {
    fileDir = '';
} else {
    fileDir = '/' + fileDir;
}

if (file.plugin && pluginsPath) {
    return '"\\"$(SRCROOT)/' + unquote(pluginsPath) + '\\""';
} else if (file.customFramework && file.dirname) {
    return '"\\"' + file.dirname + '\\""';
} else {
    return '"\\"$(SRCROOT)/' + proj.productName + fileDir + '\\""';
}

}

->

function searchPathForFile(file, proj) { var plugins = proj.pbxGroupByName('Plugins'), pluginsPath = plugins ? plugins.path : null, fileDir = path.dirname(file.path);

if (fileDir == '.') {
    fileDir = '';
} else {
    fileDir = '/' + fileDir.replace(/\\/g, "/");
}

if (file.plugin && pluginsPath) {
    return '"\\"$(SRCROOT)/' + unquote(pluginsPath.replace(/\\/g, "/")) + '\\""';
} else if (file.customFramework && file.dirname) {
    return '"\\"' + file.dirname.replace(/\\/g, "/") + '\\""';
} else {
    return '"\\"$(SRCROOT)/' + proj.productName + fileDir + '\\""';
}

}