When changing the icon of the Hard Drive in MacOS - where are the icns-file actually stored? - macos

Long story short - I bought a new computer and decided not to do a migration from my old Mac to the new one. Still - there are some things I would like to keep and the icon I found years ago to replace the "Macintosh HD" icon is something I very much would like to find.
So my question is - where are these icons actually stored? I've searched "everywhere". It's not in /System/Library/CoreServices/C­oreTypes.bundle/Contents/Resou­rces where the system icons is stored.
Anyone out there with the same level of OCD as me who can help me out?
I'm running Catalina 10.15.1 if relevant.

First of all:
Custom icons that you use to override System default ones will never be stored inside /System/Library/.. as this is a System reserved folder.
On macOS when you paste a custom icon to a folder or file using the Finder Info panel these are stored in the resource fork of the extended attributes of a file/folder.
Now regarding your use case:
In order to see these you need to show the hidden files and you will see
.VolumeIcon.icns on your / local drive (Macintosh HD):
As this is a write protected path (SIP) you cannot store custom data there and instead this .VolumeIcon.icns alias is there and will point to the actual icon file.
If you are still not able to locate the icon file you can always use this next trick. Open the Finder "Info Panel" for your MacintoshHD that has the custom icon and click on the icon representation and copy it to the clipboard (cmd + C) and then open Preview and select "File > New from Clipboard" and then save the icon as icns. Done!

Related

.srt file types doesn't exist under 'Choose default apps by file type' after after formatting windows 10, what to do?

Before I did a clean install of my desktop with windows 10 I had .srt to open by default in Sublime Text after I have formatted my computer I somehow miss the file format .srt under 'Choose default apps by file type'.
The .srt should be be between the .srf and .srw file types, but it isn't (as shown in the image here: https://answers.microsoft.com/en-us/windows/forum/windows_10-desktop-winpc/srt-files-back-to-unknown-application/e33cace8-dd59-4557-9631-e8e82a8307b3?auth=1).
If I try "open with and find Sublime (or any other software for that matter, it will open it, but it will not set it as the default program even though I checked the box) and will still appear as an unknown filetype....
If I go into properties and try to change the "open with" from there, it will just keep showing "choose a program" even still.
tried updating the computer and restart it and frankly I've given up, and it doesn't seem anyone have run into this problem before of missing a filetype under 'Choose default apps by file type'.
I also tried
1) Settings - Indexing Options
2) Advanced button
3) File Types tab
4) Add New Extension to List box, type in extension (without a period) such as "py"
5) Click Add, OK and Close
and while the format does appear in the 'Choose default apps by file type', it still doesn't let me change it at all...
Anyone got an answer to this problem?
I have now tried to go into regedit and use "search" on anything that included "sublime" and ".srt" and deleted them all... restarted the computer, reinstall sublime. The file extension I created myself in the indexing option, has been deleted.
Sublime can still open the file, but if you try to make it default program by simply opening it or or going into the files properties and do it that way, it will just open the file without it making it the default program as it should.
going into the indexing option and create the .srt extension format so it can be found under 'Choose default apps by file type' will allow you to choose notepad or wordpad as default program. When I choose either of them, the will just freeze for 1-2 sec and then nothing has changed and the extension havn't been associated with any of the programs.
I tried following the following links, and nothing has worked. Guess I'll just have to accept there is no solution rather than to live with out until I reform my PC again, cause it works without a problem on my laptop and I formatted them both the same time and installed the exact same things on both and the exact same way s:
I've tried to use the following links for help, but to no avail since non of the things I have tried have fixed it.
https://superuser.com/questions/655600/i-cant-set-a-program-as-the-default-to-open-a-filetype-with-in-windows-7
https://superuser.com/questions/91655/open-with-dialog-ignores-my-selection
https://superuser.com/questions/13653/how-to-set-the-default-program-for-opening-files-without-an-extension-in-windows
Windows 7 file extension association
One way to get an empty .srt entry back in the 'Choose default apps by file type' control panel is to create a new key for .srt in your registry under HKEY_CLASSES_ROOT:
Open Registry Editor, e.g. by typing 'regedit' into the start menu or a command prompt
At the top of the tree, right-click on 'HKEY_CLASSES_ROOT', New -> Key
Rename the new key to '.srt' and press enter to save

Path of a file in Macintosh

I'm programming on Excel-Visual Basic with a Mac, I need to charge a dll but I don't know how to specify the total path of the file, and I don't know how to find it.
For example: on Windows it works by using "C:/ ..." and separating the following documents by /.
Right click on the file in Finder
If you then hold the option button on your keyboard the Copy {filename} option in the context menu turns into Copy {filename} as Pathname
Click on that while still holding the option key and the path of the file is in your clipboard

What is an "Icon?" file?

After changing account in my Google Drive on a Windows machine, every directory when synced with my mac now has an "Icon?" file with no extension and apparently no contents.
This has happened once before after I cloned a Git directory. It gets listed on the Atom project tree simply as "Iconr"
Here is a screenshot of the file:
And this is the information I get:
Anyone know what this is? ... Doesn't seem to be doing anything ... But is making me curious!
When setting a custom icon on a folder this is where the Finder stores the image. The file itself is not visible in the Finder (but you can see it in the shell).
You can use the getFileInfo tool to see the Finder flags:
$ getFileInfo Icon^M
...
attributes: aVbstclinmEdz
...
The capital V means the invisible bit is set. If that is not the case on your system, you'll see the file in the Finder. Loosing the Finder flags is not uncommon when you transport your files through hostile territory as Google or Windows land :)
The "Icon?" files are ancient technology from Mac OS classic where (if I remember correctly) custom icons were stored in the resource fork of a file. But because folders did not have resource forks a different way to store the icon was needed and so engineers came up with the idea of a hidden file.
The filename is actually "Icon" + CR. CR is the line termination character in Mac OS classic. This name was selected to make it impossible to conflict with human entered filenames.
Oh, and, because you made me remember this stuff from more than 20 years ago, I'll save you the vote-to-close (because your question is actually off topic for Stack Overflow) :)

Creating Dropbox like DMG package

Does anyone suggest a freeware tool/script/manual_way of creating Dropbox like DMG -
Need to ask couple of questions --
I want double clicking the Folder-Icon should copy the folder(which would contain installer and uninstaller .app files of my application) into the system's /Applications folder.
Solution -- This has been solved using Applescript and changing icon of that applescript file to the folder-icon(i.e double clicking that script will move our folder(which would be present in a hidden folder) to /Applications.Any suggestions for second and third part?
Is it possible to show hyperlink of actual dropbox.com to actually open it's website?
And how we can customize volume's/Drive icon?
You can find a way to do it by reading this: Packaging a Mac OS X Application Using a DMG » asmaloney.com
I believe you can also use the trick of naming a shellscript file something.command in order to make it double clickable, (but maybe it will open the terminal, -I haven't tried it).

Setting an icon for a symbolic link

I am trying to finish a product for a client and need to create two aliases on the Desktop and the Dock to make it easy for the end-user to start the two main apps in the product. The installation script finishes off the installation by setting icons to various folders and files. The installation creates a folder under the /Applications folder, and another under the /Users/Shared folder. Each of these folders has an icon applied to them using SetFileIcon (a shareware app). The script then creates two aliases on the desktop and applies an icon to each of these aliases, again using SetFileIcon.
My first problem is that one of the aliases points to an Excel spreadsheet, but this spreadsheet gets replaced each time the update application is run. This leaves the alias pointing to the spreadsheet in the wastebasket and the new file completely unaliased. My updater application is written in Mono - so there is no easy way to call out to the Mac OS to recreate the alias, reset the icon and put it on the desktop and the dock.
I tried to work around this by creating a symbolic alias to the spread sheet using the script command and then applying an icon:
SetFileIcon "/path/to/spreadsheeticonfile" "/path/to/spreadsheet.xls"
ln -s "/path/to/updater" "/Users/$USER/updateralias"
ln -s "/path/to/spreadsheet.xls" "/Users/$USER/spreadsheetalias"
SetFileIcon "/path/to/iconfile" "/Users/$USER/spreadsheetalias"
The first SetFileIcon command works fine, and the Spreadsheet now has a new Icon associated with it. The first "ln -s" also works fine, and a new slias is created with the updater icon associated with it. The second "ln -s" creates an alias to the spreadsheet, but there is a plain white icon, not the icon associated with the spreadsheet. The last SetFileIcon is my desparate attempt to force an icon on the alias - which also does not work.
I have tried creating a bash script that launches the excel spreadsheet, and that seems to accept an icon, but seems to have a similar . But it also leaves a terminal session running, after the excel spreadsheet starts, and the alias to the bash script will also not accept an icon, even when hand-applied.
2 questions:
1. Is there any way to assign an icon to a symbolic alias that works. Even hand setting the icon on the alias using GetInfo does not work.
2. Failing getting an Alias to work, is there any workaround that would allow me at installation time to have a link on the users desktop and their dock which has the nice icon we want to use, rather than a generic excel white square. I just need an easy way to put a link with an icon to a file in another directory on the user's desktop, which will survive that file being updated periodically, and do it at install time. Simple.
Suggestions welcome.
Thanks, Neil
P.S. It probably goes with out saying that I am a MAC newbie - I originally developed this product for the client in the PC World, but he then received repeated requests to translate it for the Mac, and so, here I am struggling to learn development on the Mac.
Symbolic links are not the same as aliases. (And there is no such thing as a "symbolic alias".) You cannot set the icon of a symbolic link, because it is not a normal file, and thus can't have the appropriate properties set on it.
There are a number of ways to create an alias, but one easy one is using AppleScript:
osascript -e 'tell application "Finder" to make new alias at (path to desktop folder) to (("/path/to/file") as POSIX file)'
(NB: The path will need to exist for this to work.)
Once you've done this, you should be able to set the icon on that.

Resources