Setting an icon for a symbolic link

I am trying to finish the product for the client and you need to create two aliases on the desktop and the dock so that the end user can run the two main applications in the product. The installation script completes the installation by installing icons in various folders and files. The installation creates a folder in the / Applications folder, and the other in the / Users / Shared folder. Each of these folders has an icon applied to them using SetFileIcon (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 table is replaced every time the update application starts. This leaves an alias pointing to the table in the trash, and the new file is not fully exposed. My updater application is written in Mono - so there is no easy way to call Mac OS to recreate an alias, reset the icon and put it on the desktop and dock.

I tried to work around this by creating a symbolic alias on the distribution sheet using the script command, and then applying the 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"

SetFileIcon , , . "ln -s" , . "ln -s" , , , . SetFileIcon - - .

bash script, Excel, , , , , , . Excel, bash script .

2 : 1. , . GetInfo . 2. Alias ​​ , - , -, , , excel. , . .

.

,

P.S. , , MAC - , , Mac, Mac.

+4
1

. ( , " ".) , , , .

, AppleScript:

osascript -e 'tell application "Finder" to make new alias at (path to desktop folder) to (("/path/to/file") as POSIX file)'

(NB: .)

, .

0

Source: https://habr.com/ru/post/1542254/


All Articles