Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Failed to inject Xib files #72

Closed
qq237761250 opened this issue Mar 4, 2015 · 10 comments
Closed

Failed to inject Xib files #72

qq237761250 opened this issue Mar 4, 2015 · 10 comments

Comments

@qq237761250
Copy link

I can inject .m files,but I can's inject .xib files.The following is the error information.How to fix it?

Traceback (most recent call last):
File "/Users/guangxikatsurahayashishouzanku/.dyci/scripts/dyci-recompile.py", line 125, in
resultCode = copyResource(xibFilename, DYCI_ROOT_DIR)
File "/Users/guangxikatsurahayashishouzanku/.dyci/scripts/dyci-recompile.py", line 82, in copyResource
shutil.copy(source, bundlePath)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 119, in copy
copyfile(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 21] Is a directory: '/Users/guangxikatsurahayashishouzanku/Library/Developer/CoreSimulator/Devices/59909BFB-FD4C-412F-B04F-79C1A396F7DB/data/Containers/Bundle/Application/49287987-1933-40D8-8433-79F54AD402A8/test-40-AutoLayout.app/Demo1ViewController.nib'

@PaulTaykalo PaulTaykalo changed the title Failed to inject code Failed to inject Xib files Mar 4, 2015
@PaulTaykalo
Copy link
Member

It thinks that that file is not a directory for some reason.
https://github.com/DyCI/dyci-main/blob/master/Scripts/dyci-recompile.py#L81

it seems that this is not working now.)

@qq237761250
Copy link
Author

I don't know how to fix it! Can you help me?

@PaulTaykalo
Copy link
Member

For you to understand :) Even if I do, there's still big chance that it will not work correctly ) Xib's are pretty hard to inject (not all parts will work there)
I'll see what's going on there, but you don't need to wait fo rme to do it ) You have all the sources :)

@qq237761250
Copy link
Author

Thank you for your answer, I will try to fix it.

@PaulTaykalo
Copy link
Member

Do you have test project which are you trying to work with?

@PaulTaykalo
Copy link
Member

@qq237761250 It's more python "problem", as I said. I hate to say this, but it is working on my side, at least some simple examples )
Take a look here:
https://github.com/DyCI/dyci-main/blob/master/Scripts/dyci-recompile.py#L81

After installation this file is in your home directiory ~/.dyci/scripts/dyci-recompile.py, so you can freely edit it
The "problem is" that for some reason python think that path you're trying to inejct is not a directory (which, actually xib is). If I were you, I would try to check what path are you trying to inject, to make sure that it's actually path to xib.
After that, I would check why python think that it's not a directory )

@qq237761250
Copy link
Author

I'll according to your solution to try to solve.In the computers of the company I can correct injection xib.After work I go back to check it.

@qq237761250
Copy link
Author

I'll according to your solution to try to solve.In the computers of the company I can correct injection xib.After work I go back to check it.

@qq237761250
Copy link
Author

Dyci was correct inject xib when I was recreate the test project.
You are right,python think that path isn't a directory.

@ceyhun
Copy link

ceyhun commented Mar 18, 2015

Maybe you can rewrite starting from line number 80 like this:

# Non-Localizable Resouerces..
if source[-4:] == ".nib":
    shutil.copy(source, bundlePath + "/" + source)
    stdout.write("Nib : File " + source + " was successfully copied to application -> " + bundlePath)
elif not os.path.isdir(source):
    shutil.copy(source, bundlePath)
    stdout.write("NF : File " + source + " was successfully copied to application -> " + bundlePath)
else:
    copytree(source, bundlePath + "/" + os.path.split(source)[1])
    stdout.write("ND : File " + source + " was successfully copied to application -> " + bundlePath)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants