How to get information about file (symlink, rights)
Posted: Sun Apr 13, 2014 11:37 pm
I would like to create a file system browser that works on Mac, Win, Android, IOS. I have created a custom control that loads the files. The whole code is in the filesystem group. My problem is that I can't distinguish the files to the level I want to.
I use following commands to get the files:
The issues I have are following:
* The home, net and other folders are displayed as file out of some reason, why are these displayed as file? These are regular folders.
* Some of the symlinks are pointing to folders. I need to determine if it is a folder so that people can change in to this folder by clicking on it. How can I get more detailed information about the file?
Here the code from the "filesystem" group:
Here the output of ls -l on the filesystem:
I use following commands to get the files:
Code: Select all
put the folders into tFolders
put the files into tFiles
* The home, net and other folders are displayed as file out of some reason, why are these displayed as file? These are regular folders.
* Some of the symlinks are pointing to folders. I need to determine if it is a folder so that people can change in to this folder by clicking on it. How can I get more detailed information about the file?
Here the code from the "filesystem" group:
Code: Select all
on loadFilesInFolder pFolder
local tFolders, tFiles, tRowAmount, tTop, tLeft, tInitTop, tInitLeft, tCounter, tCounterLeft
set the folder to pFolder
put empty into tFileArray
put the folders into tFolders
put the files into tFiles
put empty into tAll
repeat for each line tFolder in tFolders
if char 1 of tFolder is not "." then
put tFolder & "," & "1087" & return after tAll
end if
end repeat
repeat for each line tFile in tFiles
if char 1 of tFile is not "." then
put tFile & "," & "1091" & return after tAll
end if
end repeat
put round(the width of me / 100, 0) into tRowAmount
put the top of me into tTop
put the left of me into tLeft
put the top of me into tInitTop
put the left of me into tInitLeft
put 1 into tCounter
put 1 into tCounterLeft
put "field" & tCounter into tName
lock screen
repeat for each line tA in tAll
set the itemdel to ","
put the item 1 of tA into tText
put the item 2 of tA into tImage
createFileButton tImage, tName, tText, tTop, tLeft
if tCounterLeft is tRowAmount then
add 80 to tTop
put tInitLeft into tLeft
put 1 into tCounterLeft
else
add 100 to tLeft
add 1 to tCounterLeft
end if
add 1 to tCounter
put "field" & tCounter into tName
end repeat
unlock screen
end loadFilesInFolder
on createFileButton pIcon, pName, pText, pTop, pLeft
--create button pName in group "filesystem"
create button pName in me
set the icon of button pName to pIcon
set the hiliteIcon of button pName to pIcon
set the label of button pName to char 1 to 12 of word 1 of pText
set the toolTip of button pName to pText
set the width of button pName to 100
set the height of button pName to 80
set the left of button pName to pLeft
set the top of button pName to pTop
set the lockLoc of button pName to true
set the threeD of button pName to false
set the borderWidth of button pName to 0
set the btType of button pName to true
end createFileButton
on createFolderButton
end createFolderButton
on removeButtons
local a
-- Lock the screen so that this is nice and fast
lock screen
-- Loop through all the controls in the stack. NOTE: we have to loop downwards to zero as we may be
-- removing controls while in the loop - not doing this causes Badness.
repeat with a = the number of controls down to 1
-- Check the custom property "cPreviewControl" to see if this control is a thumbnail image and delete it.
if the btType of control a is true then delete control a
end repeat
unlock screen
end removeButtons
Code: Select all
charms:adstation$ ls -l /
total 16446
drwxrwxr-x+ 75 root admin 2550 Apr 12 14:55 Applications
drwxr-xr-x+ 64 root wheel 2176 Mar 2 12:27 Library
drwxr-xr-x@ 2 root wheel 68 Aug 25 2013 Network
drwxr-xr-x+ 4 root wheel 136 Nov 10 19:54 System
lrwxr-xr-x 1 root wheel 49 Feb 21 18:55 User Information -> /Library/Documentation/User Information.localized
drwxr-xr-x 6 root admin 204 Feb 21 18:55 Users
drwxrwxrwt@ 6 root admin 204 Apr 13 22:51 Volumes
drwxr-xr-x@ 39 root wheel 1326 Mar 1 19:06 bin
drwxrwxr-t@ 3 root admin 102 Apr 11 21:18 cores
dr-xr-xr-x 3 root wheel 4774 Mar 30 01:27 dev
lrwxr-xr-x@ 1 root wheel 11 Nov 10 19:48 etc -> private/etc
dr-xr-xr-x 2 root wheel 1 Mar 30 01:27 home
-rwxr-xr-x@ 1 root wheel 8393408 Feb 18 00:23 mach_kernel
dr-xr-xr-x 2 root wheel 1 Mar 30 01:27 net
drwxr-xr-x 3 root wheel 102 Sep 27 2012 opt
drwxr-xr-x@ 6 root wheel 204 Nov 10 19:56 private
drwxr-xr-x@ 62 root wheel 2108 Mar 1 19:06 sbin
lrwxr-xr-x@ 1 root wheel 11 Nov 10 19:48 tmp -> private/tmp
drwxr-xr-x@ 12 root wheel 408 Feb 21 23:39 usr
lrwxr-xr-x@ 1 root wheel 11 Nov 10 19:48 var -> private/var