-
-
Notifications
You must be signed in to change notification settings - Fork 320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting notAFile
error when trying to add PBXFileReference to a dynamic framework
#230
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! |
Hey @fuzza! Very good catch. I'd say just check if the file exists before adding it. I think it should be enough but you can ask @ilyapuchka to get more context on why he used |
Yes, I guess to do that |
:) In Xcake we had to handle special handling for bundles i.e |
@jcampbell05 that layer is handled by XcodeGen, which does something similar. |
Agree with @yonaskolb. From xcproj we expect the consumer of the library, like XcodeGen, to handle the file types accordingly. |
@pepibumur, @yonaskolb, @ilyapuchka |
Context 🕵️♀️
I'm writing a script that integrates Carthage dynamic frameworks to XCode project using
xcproj
What 🌱
In order to create PBXFileReference to dynamic framework file, I'm trying to use the following function from
PBXProjObjects+Helpers.swift
:In case of dynamic framework, it throws an
XCodeProjEditingError.notAFile(path: filePath)
exception regardless if file exsits or not.After some investigation, I found that
filePath
parameter is validated using PathKit'sisFile
var which returns false if the path points to a directory.Since all dynamic frameworks are directories from file system PoV, it produces the issue.
I assume that adding files of some other types, such as
xcassets
,pbxproj
etc. could be affected as well.Proposal 🎉
The simplest fix for the issue is to change
isFile
check toexists
.More complex one is to explicitly mark
PBXFileReference.fileTypeHash
with file or directory attribute (e.g using enum) and choose appropriate validation method.I would appreciate any feedback on the issue and let me know if you want me to tackle this issue.
The text was updated successfully, but these errors were encountered: