note 65706 added to function.is-link
| From: | brendy at gmail dot com | Date: | Sat, 06 May 2006 02:22:27 +0000 |
| Subject: | note 65706 added to function.is-link | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-110674@lists.php.net to get a copy of this message | ||
On Mac OSX, to see if a file is a FInder alias:
<?PHP
if( getFinderAlias( $someFile , $target ) ) {
echo $target;
}
else {
echo "File is not an alias";
}
function getFinderAlias( $filename , &$target ) {
$getAliasTarget = <<< HEREDOC
-- BEGIN APPLESCRIPT --
set checkFileStr to "{$filename}"
set checkFile to checkFileStr as POSIX file
try
tell application "Finder"
if original item of file checkFile exists then
set targetFile to (original item of file checkFile) as alias
set posTargetFile to POSIX path of targetFile as text
get posTargetFile
end if
end tell
end try
-- END APPLESCRIPT --
HEREDOC;
$runText = "osascript << EOS\n{$getAliasTarget}\nEOS\n";
$target = trim( shell_exec( $runText ) );
return ( $target == "" ? false : true );
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 24.130.252.17
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.is-link.php
Edit -- http://master.php.net/note/edit/65706
Del: integrated -- http://master.php.net/note/delete/65706/integrated
Del: useless -- http://master.php.net/note/delete/65706/useless
Del: bad code -- http://master.php.net/note/delete/65706/bad+code
Del: spam -- http://master.php.net/note/delete/65706/spam
Del: non-english -- http://master.php.net/note/delete/65706/non-english
Del: in docs -- http://master.php.net/note/delete/65706/in+docs
Del: other reasons-- http://master.php.net/note/delete/65706
Reject -- http://master.php.net/note/reject/65706
Search -- http://master.php.net/manage/user-notes.php