This is an automated email from the ASF dual-hosted git repository.

dpogue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-node-xcode.git


The following commit(s) were added to refs/heads/master by this push:
     new 2f89486  fix(windows): Fix path issues on Windows (#170)
2f89486 is described below

commit 2f8948618f714aa799411c5e2c7bddf3b5774755
Author: Darryl Pogue <[email protected]>
AuthorDate: Mon Jun 15 23:01:24 2026 -0700

    fix(windows): Fix path issues on Windows (#170)
    
    * ci(windows): Runs tests on Windows too
    
    * fix(windows): Fix path issues on Windows
---
 .gitattributes            | 18 ++++++++++++++++++
 .github/workflows/ci.yml  |  3 ++-
 lib/pbxFile.js            |  2 +-
 lib/pbxProject.js         |  8 ++++----
 test/dataModelDocument.js |  4 ++--
 5 files changed, 27 insertions(+), 8 deletions(-)

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 6d92575..59dcef9 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 332a324..299a7cc 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 fc2b648..709c84d 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);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to