์๋ ์ค์ ํ์ผ ์ฐ๊ฒฐ, ์ฆ Explorer/Finder์์ ํ์ผ์ ์ด ํ๋ก๊ทธ๋จ์ ์ ํํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋๋ ๊ณต์ ํฉ๋๋ค.
๋จผ์ ๋ฌธ์ . ํ์ํ ํ์ฅ์๋ฅผ ๊ฐ์ง ํ์ผ์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ด๋ค ๊ฒ์์๋ ์ด๋ฆฌ์ง ์๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ผ๋ฉฐ ์ด๋ฆฌ๋ฉด ์ผ๋ถ iTunes์์ ์ด๋ฆฝ๋๋ค. Windows์์๋ ํ๋ก๊ทธ๋จ์ ์ค์น(๋๋ ์ ๊ฑฐ)ํ ๋ ํ์ํ ์ฐ๊ฒฐ์ด ์์ ํ ์์ค๋๋ ๊ฒฝ์ฐ๊ฐ ์์ต๋๋ค. ๋๋ก๋ GIMP๋ฅผ ์ ๊ฑฐํ๋ฉด ico ํ์ผ์ด ์ผ๋ฐ ํ์ผ ๋ทฐ์ด์์ ํ์ค ์ฌ์ง ๊ฐค๋ฌ๋ฆฌ๋ก ์ฎ๊ฒจ์ง๋๋ค. ์? ๋ฌด์์ ์ํด? ์ ์ ์์... ์ ํธ์ง๊ธฐ๋ฅผ ์ฐพ์๊ฑฐ๋ ์ฌ๋ฌ ๊ฐ์ง ์ด์ ๋ก ์๋ก ์ค์นํ ๊ฒฝ์ฐ์๋ ์ด๋ป๊ฒ ๋๋์? ์ปดํจํฐ๊ฐ ๋ ๋ ์ด์์ด๋ผ๋ฉด ์ด๋ป๊ฒ ๋๋์? ์ผ๋ฐ์ ์ผ๋ก ๋ํ์์ ๋ง์ฐ์ค๋ฅผ ํด๋ฆญํ๋ ๊ฒ์ ๋งค์ฐ ์ค๋ฝ์ ์ ๋๋ค.
๋์ Dropbox์ ๋ ๊ฐ์ ํ์ผ์ ์ ์ฅํ๊ณ ์ด์ ๊ฑฐ์ ์ฆ์ ์ปดํจํฐ ์ธ๊ณ๋ฅผ ์ ์์ผ๋ก ๋๋๋ฆด ์ ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋ฌด์์ ๊ทธํ ๋ก ์ค๋ซ๋์ ๊ธฐ๋ค๋ ค์ค์ จ๋์... ๋ค์์ Windows์ macOS์ฉ ๋ ์ํผ์ ๋๋ค.
Windows
Windows ์ฝ์์์ cmd.exe
์ด๋ ๋ ๋จ๊ณ๋ก ์ํ๋ฉ๋๋ค.
ftype my_file_txt="C:Windowsnotepad.exe" "%1"
assoc .txt=my_file_txt
๋ณ๊ฒฝ ์ฌํญ์ ์ฆ์ ์ ์ฉ๋ฉ๋๋ค. ์ฐ๊ฒฐ์ด ํน์ ์ฌ์ฉ์์ ๋ํด ๋ฑ๋ก๋์ด ์๋ค๋ ์ฌ์ค์๋ ๋ถ๊ตฌํ๊ณ ์ด๋ค ์ด์ ๋ก ์ด๋ฌํ ๋ช ๋ น์ ๊ด๋ฆฌ์๋ก ์คํํด์ผ ํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ bat ํ์ผ์์ ์คํํ ๋ ๋ฐฑ๋ถ์จ ๊ธฐํธ(%%1)๋ฅผ ๋ ๋ฐฐ๋ก ๋๋ฆฌ๋ ๊ฒ์ ์์ง ๋ง์ธ์. Windows 7 Ultimate 64๋นํธ์ ๋ง๋ฒ์ ์ธ๊ณโฆ
macOS
MacOS์์๋ ์ ํธ๋ฆฌํฐ๋ฅผ ์ฌ์ฉํ์ฌ ์ฐ๊ฒฐ์ ์ค์ ํ๋ ๊ฒ์ด ํธ๋ฆฌํฉ๋๋ค. brew install duti
. ์ฌ์ฉ ์:
duti -s com.apple.TextEdit .txt "editor"
๋ณ๊ฒฝ ์ฌํญ์ ์ฆ์ ์ ์ฉ๋๋ฉฐ sudo๊ฐ ํ์ํ์ง ์์ต๋๋ค. ์ฌ๊ธฐ์ "com.apple.TextEdit" ์ธ์๋ ์ฐ๋ฆฌ๊ฐ ํ์๋ก ํ๋ ํ๋ก๊ทธ๋จ์ ์์ "๋ฒ๋ค ID"์ ๋๋ค. "editor" ์ธ์๋ ์ฐ๊ด ์ ํ์ ๋๋ค. ํธ์ง์ ๊ฒฝ์ฐ "editor", ๋ณด๊ธฐ์ ๊ฒฝ์ฐ "viewer", ๋ชจ๋ ํญ๋ชฉ์ ๊ฒฝ์ฐ "all"์ ๋๋ค.
๋ค์๊ณผ ๊ฐ์ด "๋ฒ๋ค ID"๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ์ธ ๋ฒ์งธ ๋ฒ์ ์ "/Applications/Sublime Text.app"์ด ์๋ ๊ฒฝ์ฐ ํด๋น ๋ฒ๋ค ID๋ "com.sublimetext.3" ๋๋ ๋ค๋ฅธ ID๊ฐ ๋ฉ๋๋ค.
> osascript -e 'id of app "Sublime Text"'
com.sublimetext.3
macOS Sierra์์ ํ ์คํธ๋์์ต๋๋ค.
Windows์ฉ ์ต์ข ์คํฌ๋ฆฝํธ(.bat)
@echo off
set XNVIEW=C:Program Files (x86)XnViewxnview.exe
set SUBLIME=C:Program FilesSublime Text 3sublime_text.exe
set FOOBAR=C:Program Files (x86)foobar2000foobar2000.exe
call :assoc_ext "%SUBLIME%" txt md js json css java sh yaml
call :assoc_ext "%XNVIEW%" png gif jpg jpeg tiff bmp ico
call :assoc_ext "%FOOBAR%" flac fla ape wav mp3 wma m4a ogg ac3
goto :eof
:assoc_ext
set EXE=%1
shift
:loop
if "%1" neq "" (
ftype my_file_%1=%EXE% "%%1"
assoc .%1=my_file_%1
shift
goto :loop
)
goto :eof
macOS(.sh)์ฉ ์ต์ข ์คํฌ๋ฆฝํธ
#!/bin/bash
# this allows us terminate the whole process from within a function
trap "exit 1" TERM
export TERM_PID=$$
# check `duti` installed
command -v duti >/dev/null 2>&1 ||
{ echo >&2 "duti required: brew install duti"; exit 1; }
get_bundle_id() {
osascript -e "id of app """ || kill -s TERM $TERM_PID;
}
assoc() {
bundle_id=$1; shift
role=$1; shift
while [ -n "$1" ]; do
echo "setting file assoc: $bundle_id .$1 $role"
duti -s "$bundle_id" "." "$role"
shift
done
}
SUBLIME=$(get_bundle_id "Sublime Text")
TEXT_EDIT=$(get_bundle_id "TextEdit")
MPLAYERX=$(get_bundle_id "MPlayerX")
assoc "$SUBLIME" "editor" txt md js jse json reg bat ps1 cfg sh bash yaml
assoc "$MPLAYERX" "viewer" mkv mp4 avi mov webm
assoc "$MPLAYERX" "viewer" flac fla ape wav mp3 wma m4a ogg ac3
์ถ์ฒ : habr.com