2006-02-23から1日間の記事一覧

自分のいるディテクトリを返す

getCwd(path to me) on getCwd(thePathToMe) set thePath to POSIX path of ((thePathToMe) as string) as string set theCwd to do shell script "perl -e '?"" & thePath & "?"=~ m@^(.+/).+/?@;print $1;'" return theCwd as string end getCwd

ファイル指定まとめ

俺々ルール POSIXパスの文字列で取り扱う。 ディレクトリは"/"で終わる。 "/hoge/moge/" -- ディレクトリ "hoge/moge" -- ファイル パッケージ化されたファイルをfileパスに変換するとディレクトリ扱いになる(あたりまえ) "/hoge/moge.app" as POSIX file …