egold / better-xcode-ibeam-cursor

Better i-bar (text cursor) for Xcode for dark background / light text color themes.
429 stars 28 forks source link

Xcode 7.3 beta 2 unable to find the path no more #16

Closed tobatha closed 8 years ago

tobatha commented 8 years ago

Hey, anybody downloaded Xcode 7.3 beta 2, and tried to replace the cursor but found no *cursor.tiff under the directory?

tomaskraina commented 8 years ago

That would explain why running the script doesn't change the cursor in Xcode 7.3b2

maxsz commented 8 years ago

There is another Ibeam file here: /Applications/Xcode-beta.app/Contents/OtherFrameworks/XcodeEdit.framework/Versions/A/Resources/TIbeam.tiff, but replacing it doesn't change anything.

allen-zeng commented 8 years ago

Same problem with Xcode 7.3b4

hirad commented 8 years ago

+1

egold commented 8 years ago

Welcoming pull requests for this that are backwards compatible to Xcode pre-7.3 :) @tobatha @tomaskraina @maxsz @allen-zeng @hirad

hirad commented 8 years ago

Well... I spent a long time looking for the new location of the cursor file. Haven't been able to find it yet.

cjheng commented 8 years ago

Now that Xcode 7.3 has been released I took another look through the DVTKit.framework resources and noticed Assets.car (full path: /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Assets.car) which contains, among many other assets, DVTIbeamCursor.png and DVTIbeamCursor@2x.png.

Unfortunately I don't have experience working with .car files but I eventually found https://github.com/alexzielenski/ThemeEngine. The application seems to be designed to work with Photoshop, but based on https://github.com/alexzielenski/ThemeEngine/issues/23#issuecomment-197539346 I managed to replace DVTIbeamCursor@2x.png via drag and drop. After backing up the original Assets.car and replacing it with a modified version Xcode 7.3 appears to use the replaced cursor png.

ClintChil commented 8 years ago

Huzzah! Will test this in the AM. Thanks for sharing!

allen-zeng commented 8 years ago

Confirmed - updated Assets.car and all is right again! Here is Assets.car.zip if you don't want to go through the trouble yourself.

Thanks @cjheng for the investigations!

danipralea commented 8 years ago

I can confirm @cjheng's solution is a working one. Thank you!

tobatha commented 8 years ago

pull a request & update the tutorial then, i guess~ lol thank you guys, anyway!

sokobania commented 8 years ago

I also confirm @cjheng's solution worked for me.

I just had to fix a compile error which I can't remember precisely: NonNull something... I just double clicked the Xcode suggestion to fix it. I also had to go to ThemeKit.framework > Targets > ThemeEngine > General > Embedded binaries and remove the ../../[etc.]/DerivedData

Then menu Product > Run

Once inside ThemeEngine: menu File > open /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Assets.car Find DVTIbeamCursor. Click on the icon to the right. Drag from the finder your DVTIbeamCursor.tiff to the icon on the right. Menu File > Save Restart Xcode. :-) Thank you very much!

ebaker355 commented 8 years ago

I have added a PR to update the install.sh script, using the Assets.car file that was added in this thread (thanks @allen-zeng!)

spritekitbook commented 8 years ago

So awesome, thank you!

Looking for the I-Beam all the time using my theme was getting old. Appreciate it.

LogicException commented 8 years ago

Great work, thank's a lot

v-i-s-h-a-l commented 8 years ago

Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Versions/A/Resources/Assets.car

deleting this Assets.car file does the work for me (may be because I had already installed the i-beam cursor in Xcode 7.2).

update: It worked for a while but later Xcode would not even start and crash on launch. So, I replaced the new Assets.car file at the above mentioned location.

fbara commented 8 years ago

When I ran the script in the tutorial I got cp: /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff: No such file or directory.

After that, the terminal result looks like it changed the cursor but I can't really see a difference: Copying the improved ibeam cursor to the correct location Removing downloaded image.

egold commented 8 years ago

@ebaker355 I'm really interested in your binary diff script. It sounds like a good enough solution. Please reopen your pull request once you have it working. Thanks!

egold commented 8 years ago

Updated README to reflect this manual workaround. Thanks all for looking into it.

ebaker355 commented 8 years ago

The PR has been reopened with the updated install script. Sorry it took so long!

oliverfoggin commented 8 years ago

Please could you provide instructions on how to use your updated install script? Thanks

ebaker355 commented 8 years ago

@oliverfoggin Sure. The easiest way to test the script:

curl -O https://raw.githubusercontent.com/ebaker355/better-xcode-ibeam-cursor/master/install.sh
chmod a+x install.sh

Edit the GITHUB_URL constant path (line 4), change "egold" to "ebaker355" (this is only needed until the PR is merged; it allows the script to find the patch files in my fork).

Then, simply:

./install.sh

The output should be similar to:

Updating I-beam cursor for Xcode at path /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources
Downloading cursor patch file to /tmp/Assets.car-Xcode-7.3.bspatch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1431  100  1431    0     0   1553      0 --:--:-- --:--:-- --:--:--  1552
Downloaded successfully.
Creating backup of Assets.car -> backup-Assets.car
Xcode has been patched successfully. Please restart Xcode and have fun!
oliverfoggin commented 8 years ago

@ebaker355 thanks. At the moment when I do that I get the output...

Olivers-MBP:Documents oliverfoggin$ ./install.sh
Updating I-beam cursor for Xcode at path /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources
Downloading cursor replacement file to /tmp/DVTIbeamCursor.tiff
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     9  100     9    0     0     27      0 --:--:-- --:--:-- --:--:--    27
Download failed.

I tried with sudo also.

I'll take a look through the install.sh to see if I can work out what's happening.

Thanks

ebaker355 commented 8 years ago

@oliverfoggin ah, i see you're testing it with an older (< 7.3) version of Xcode... that's good, as I was only able to test with 7.3.

Oh, I think I know the cause... one minute, please, and I'll update the script.

oliverfoggin commented 8 years ago

@ebaker355 Xcode Version 7.3 (7D175)

New install (from AppStore) on a new computer so no updates applied.

ebaker355 commented 8 years ago

Strange... is there both a DVTIbeamCursor.tiff and an Assets.car file in your /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources path?

oliverfoggin commented 8 years ago

Yeah I have both of those files. However, when I try to download this file... https://raw.githubusercontent.com/ebaker355/better-xcode-ibeam-cursor/master/patches/DVTIbeamCursor.tiff manually I get a damaged file. Could that be the problem?

ebaker355 commented 8 years ago

Yes... i have the wrong path to the updated DVTIbeamCursor.tiff file in the script. I am currently updating the script to fix that.

But, its puzzling, because, I thought that DVTIbeamCursor.tiff file was no longer used in Xcode 7.3. Please try moving that file out of the Xcode directory, then re-run the script. It should update the Assets.car file.

oliverfoggin commented 8 years ago

That worked! Thanks. I renamed the DVTIbeamCursor.tiff file and then got the output...

Updating I-beam cursor for Xcode at path /Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources
Downloading file Assets.car-Xcode-7.3.bspatch
Downloading cursor patch file to /tmp/Assets.car-Xcode-7.3.bspatch
Downloading from - https://raw.githubusercontent.com/ebaker355/better-xcode-ibeam-cursor/master/patches/Assets.car-Xcode-7.3.bspatch
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1431  100  1431    0     0   4459      0 --:--:-- --:--:-- --:--:--  4471
Downloaded successfully.
Creating backup of Assets.car -> backup-Assets.car

(I added some extra debugging lines to the script).

Restarting Xcode then got the new cursor thanks :D

ebaker355 commented 8 years ago

Awesome! Glad it worked.

So, as of now, the script assumes that either the Assets.car file or the DVTIbeamCursor.tiff file exists, but not both. The Assets.car file is new with Xcode 7.3. It checks for the existence of the tiff file first, but I'm thinking it should check for Assets.car first.

Also, the script will only update one file or the other. I'm wondering if it should update both files, if they both exist.

Anyone have thoughts on this?

oliverfoggin commented 8 years ago

I agree that it should probably check for the Assets.car file first and use that to assume 7.3+.

I did manually update the .tiff file but it had no effect on the cursor in Xcode. I can't say for certain that it isn't used anywhere else though? Is it left behind as a legacy item in that particular framework maybe?

I don't see there being any harm in updating both files though.

ebaker355 commented 8 years ago

@oliverfoggin Wondering... did you update to Xcode 7.3 thru the App Store? That may have left the older file behind. For my installation, I removed the old Xcode.app directory, and installed 7.3 from the .dmg file.

Thanks for all your testing, btw! :D

oliverfoggin commented 8 years ago

@ebaker355 I'm on a brand new computer that I only got on Monday and I installed Xcode 7.3 straight from the AppStore.

No updates have been applied to Xcode. Just a straight install from AppStore.

Thanks

ebaker355 commented 8 years ago

@oliverfoggin Ok, thanks!

The script has been updated to look for Assets.car before DVTIbeamCursor.tiff. It still only updates the first one of these files that is found.

kartikthapar commented 8 years ago

Does anybody have clear instructions as to how to get this to work? I have tried the steps above but my download still fails (irrespective of the presence of .car or .tiff)

cc: @ebaker355 @oliverfoggin

ebaker355 commented 8 years ago

@kartikthapar I'm sorry you're experiencing difficulties with the script. Can you please paste your Terminal session here? Perhaps I can help troubleshoot. Thanks!

sokobania commented 8 years ago

@ebaker355 Instead of checking for the existence of both files, wouldn't it be better to check first for the version of Xcode (if it's possible)? And then, according to the version, do whatever seems needed (AND check for the existence of THE file to change).

ebaker355 commented 8 years ago

@sokobania Good question! The problems I saw with that approach were:

I think the file approach is more flexible for these reasons. We take the extra step of validating the SHA's of the files we find, to ensure our patches are compatible. That way, if future versions of Xcode use new versions of these files, or if the files are replaced (or renamed), we can simply generate new patches and update the script as needed.

ebaker355 commented 8 years ago

I have added support for Xcode 7.3.1 to the PR.

Anyone experiencing issues with the installer?

oliverfoggin commented 8 years ago

Just updated to 7.3.1 and had to run the script again. I made sure to get the latest version and change egold to ebaker355.

Anyway, it worked perfectly.

Thanks

pwinde commented 8 years ago

I had an issue with the installer for 7.3.1.

File checksum mismatch.
Assets.car - c5422358f21247b31921b1e9fee421e2c7c84c41
Patch cannot be applied.

Turned out that the install script got confused with the path to xcode and used path to an previously installed beta. Deleting the old beta fixed the issue.

pwinde commented 8 years ago

My bad. The installation actually worked for the released version of Xcode but I when I saw the error for the beta I assumed that it was for the released version.

fbara commented 8 years ago

@Sjolin I had to rerun the script again for 7.3.1, too, but it didn't work for me. I restarted Xcode, also.

MacBookPro:~ fbara$ curl -L https://raw.githubusercontent.com/egold/better-xcode-ibeam-cursor/master/install.sh | bash 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1161  100  1161    0     0   3132      0 --:--:-- --:--:-- --:--:--  3137
Downloading new image
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 31380  100 31380    0     0  90650      0 --:--:-- --:--:-- --:--:-- 90956
Backing up the original cursor that ships with xcode to ./backup-DVTIbeamCursor.tiff
Copying the improved ibeam cursor to the correct location
Removing downloaded image
Done - restart Xcode and have fun!
claybridges commented 8 years ago

@ebaker355 Beautiful shell scripting. Once I changed the GITHUB_URL, it worked like a charm. I kiss you!

ebaker355 commented 8 years ago

@Sjolin Hmm, it looks like the script updated the wrong file for Xcode 7.3.1. It should be updating Assets.car, not DVTIbeamCursor.tiff. Strange. I will run some tests to see what's happening there. Either way, DVTIbeamCursor.tiff is no longer used by Xcode, so that would explain why Xcode isn't using the updated cursor.

@claybridges Great to hear! Thanks!

ntpeters commented 8 years ago

Worked perfectly for me as well!

fbara commented 8 years ago

I ran the script again (Xcode 7.3.1) but don't see the updated cursor. I don't know if the install.sh has been updated with what everyone has been discussing for the last few weeks.

MacBookPro:~ fbara$ curl -L https://raw.githubusercontent.com/egold/better-xcode-ibeam-cursor/master/install.sh | bash 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1161  100  1161    0     0   1412      0 --:--:-- --:--:-- --:--:--  1412
Downloading new image
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 31380  100 31380    0     0  41080      0 --:--:-- --:--:-- --:--:-- 41073
Backing up the original cursor that ships with xcode to ./backup-DVTIbeamCursor.tiff
Password:
Copying the improved ibeam cursor to the correct location
Removing downloaded image
Done - restart Xcode and have fun!
ntpeters commented 8 years ago

@fbara this hasn't been merged yet, you need to grab it from @ebaker355's fork:

curl -L https://raw.githubusercontent.com/ebaker355/better-xcode-ibeam-cursor/master/install.sh

Once you have install.sh downloaded, you also need to open it up and update the GITHUB_URL to also point to @ebaker355's fork:

GITHUB_URL="https://raw.githubusercontent.com/ebaker355/better-xcode-ibeam-cursor/master"

After this it should work!

fbara commented 8 years ago

Thanks @ntpeters, that worked! I thought it was already merged, sorry.

egold commented 8 years ago

Fixed in #17 -- thanks @ebaker355 !