diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..32f4c2b --- /dev/null +++ b/.gitattributes @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +*.pbxproj eol=lf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f564841..6448b83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: strategy: matrix: - os: [ubuntu-latest, macos-26] + os: [windows-latest, ubuntu-latest, macos-26] # The "--test-coverage-exclude" flag is supported in v22.5.0 and later. # By default, all matching test files are excluded from the coverage report. # Only Node.js 22.x requires explicitly declaring test file exclusions. @@ -100,6 +100,7 @@ jobs: NODE_OPTIONS: ${{ matrix.node.options }} - name: Check for uncommitted changes + if: ${{ ! startsWith(matrix.os, 'windows') }} run: | if ! git diff --exit-code; then echo "" diff --git a/lib/pbxFile.js b/lib/pbxFile.js index e6072c7..ddaf4f9 100644 --- a/lib/pbxFile.js +++ b/lib/pbxFile.js @@ -165,7 +165,7 @@ function defaultPath (fileRef, filePath) { } if (defaultPath) { - return path.join(defaultPath, path.basename(filePath)); + return path.posix.join(defaultPath, path.basename(filePath)); } return filePath; diff --git a/lib/pbxProject.js b/lib/pbxProject.js index a0e6fb4..4c76988 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -39,7 +39,7 @@ function PBXProject (filename) { util.inherits(PBXProject, EventEmitter); PBXProject.prototype.parse = function (cb) { - const worker = fork(path.join(__dirname, '/parseJob.js'), [this.filepath]); + const worker = fork(path.join(__dirname, 'parseJob.js'), [this.filepath]); worker.on('message', function (msg) { if (msg.name === 'SyntaxError' || msg.code) { @@ -1392,7 +1392,7 @@ PBXProject.prototype.addTarget = function (name, type, subfolder, bundleId) { // Setup uuid and name of new target const targetUuid = this.generateUuid(); const targetType = type; - const targetSubfolder = subfolder || name; + const targetSubfolder = (subfolder || name).replace(/\\/g, '/'); const targetName = name.trim(); const targetBundleId = bundleId; @@ -1418,7 +1418,7 @@ PBXProject.prototype.addTarget = function (name, type, subfolder, bundleId) { isa: 'XCBuildConfiguration', buildSettings: { GCC_PREPROCESSOR_DEFINITIONS: ['"DEBUG=1"', '"$(inherited)"'], - INFOPLIST_FILE: '"' + path.join(targetSubfolder, targetSubfolder + '-Info.plist' + '"'), + INFOPLIST_FILE: '"' + path.posix.join(targetSubfolder, targetSubfolder + '-Info.plist' + '"'), LD_RUNPATH_SEARCH_PATHS: '"$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"', PRODUCT_NAME: '"' + targetName + '"', SKIP_INSTALL: 'YES' @@ -1428,7 +1428,7 @@ PBXProject.prototype.addTarget = function (name, type, subfolder, bundleId) { name: 'Release', isa: 'XCBuildConfiguration', buildSettings: { - INFOPLIST_FILE: '"' + path.join(targetSubfolder, targetSubfolder + '-Info.plist' + '"'), + INFOPLIST_FILE: '"' + path.posix.join(targetSubfolder, targetSubfolder + '-Info.plist' + '"'), LD_RUNPATH_SEARCH_PATHS: '"$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks"', PRODUCT_NAME: '"' + targetName + '"', SKIP_INSTALL: 'YES' diff --git a/test/dataModelDocument.js b/test/dataModelDocument.js index b627c3c..935735a 100644 --- a/test/dataModelDocument.js +++ b/test/dataModelDocument.js @@ -26,8 +26,8 @@ const path = require('node:path'); const PBXProject = require('../lib/pbxProject'); const PBXFile = require('../lib/pbxFile'); const proj = new PBXProject('.'); -const singleDataModelFilePath = path.join(__dirname, '/fixtures/single-data-model.xcdatamodeld'); -const multipleDataModelFilePath = path.join(__dirname, '/fixtures/multiple-data-model.xcdatamodeld'); +const singleDataModelFilePath = path.join(__dirname, 'fixtures', 'single-data-model.xcdatamodeld'); +const multipleDataModelFilePath = path.join(__dirname, 'fixtures', 'multiple-data-model.xcdatamodeld'); function cleanHash () { return JSON.parse(fullProjectStr);