"Non-portable path to file "File.h"; specified path differs in case from file name on disk" warning in bridging header after updating to Xcode 8.3
Asked Answered
S

5

29

I updated to Xcode 8.3 and Swift 3.1 and got this warning in my bridging header file, referencing to an Objective-C header file:

Non-portable path to file "File.h"; specified path differs in case from file name on disk

How can I resolve this?

Sestina answered 28/3, 2017 at 10:23 Comment(0)
S
44

It turned out that I misspelled the file's name, the correct name was "FILE.h" instead of "File.h". The warning appeared because of the soon coming APFS to macOS.

Sestina answered 28/3, 2017 at 10:23 Comment(5)
But when you upgrade your file system to APFS, it will be case sensitive and this code will no longer compile.Lark
Thanks, I will include this in my answer.Firdausi
I'm getting a bunch of these warnings and they're all false. Why would it flag the problem when it doesn't exist?Huff
me too! damn capital lettersShiite
Thanks. Renamed the file according to the class name and the warning disappeared.Zins
B
2

In my case, the !!project folder name!! isn't match the bridging header path.

I changed

"project/project-Bridging-Header.h"

to

"Project/project-Bridging-Header.h"

Tested on Xcode 9.3

Bookstall answered 30/3, 2018 at 7:48 Comment(0)
N
2

One additional cause, that I experienced, was that a library project was importing itself incorrectly. For example, given projects Main and Library, Main would import Library with:

#import "Library/Library.h"

If Library attempts to use the same import, the Non-portable path warning will appear. Removing the path portion is the easy fix:

#import "Library.h"

The better fix is to import the specific components that Library needs from itself:

#import "Widget.h"
#import "NSString+Library.h" 
Nauseous answered 9/9, 2019 at 13:44 Comment(0)
L
1

Encountered the problem in Qt (C++) on a MacOS computer from a code developed and working on Ubuntu.

My project had two files : server.cpp and Server.cpp.

The solution was to change the name of one file or the other.

Lavelle answered 15/11, 2020 at 1:41 Comment(0)
H
0

If you can't change the file names because it's a library code you could make the files that include your libraries case-sensitive! (If your PC is Windows 10 or up)

  1. Open Powershell(Admin)
  2. Use Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux too enable case-sensitivity atribute
  3. Restart the PC
  4. Usefsutil.exe file SetCaseSensitiveInfo YourDestinationFolder enable to enable case-sentivity

This could make the file case sensitive and solve the build problem.

Hausa answered 28/7, 2023 at 8:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.