home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club KidSoft Volume 3 #1
/
ClubKidsoft.iso
/
movies
/
shared.dir
/
00501_Script_501
< prev
next >
Wrap
Text File
|
1995-02-08
|
2KB
|
84 lines
-- FILES
on FileExists fileName
put fileio(mNew, "read", fileName) into fileObj
if objectP(fileObj) = TRUE then
fileObj(mDispose)
return TRUE
else
return FALSE
end if
end
on GetFileNameFromPathName pathName
global gSep
put the number of chars of pathName into numChars
repeat with i = numChars down to 1
if char i of pathName = gSep then return char (i+1) to numChars of pathName
end repeat
return pathName
end
on GetFiles pathName
put empty into theFiles
repeat with i = 1 to 10000 -- !!! assumes never more than 10000 files in a folder
put getNthFileNameInFolder(pathname, i) into n
if n = EMPTY then exit repeat
put n into line i of theFiles
end repeat
return theFiles
end GetFiles
on GetPathNameFromFileName pathName
global gSep
put the number of chars of pathName - 1 into numChars -- skip last colon if there is one, assumes all names at least 1 char long
repeat with i = numChars down to 1
if char i of pathName = gSep then return char 1 to i of pathName
end repeat
return pathName
end
-- NOTE: Caller must check the return value
on EraseFile fileName
set file = FileIO(mNew, "read", fileName)
if not objectP(file) then
return empty
else
put file(mDelete) into fileData
return fileData
end if
end
-- NOTE: Caller must check the return value
on ReadFile fileName
set file = FileIO(mNew, "read", fileName)
if not objectP(file) then
return empty
else
put file(mReadFile) into fileData
file(mDispose)
return fileData
end if
end
-- NOTE: Callers must check the return value
on WriteFile fileName, data
set file = FileIO(mNew, "write", fileName)
if not objectP(file) then
return FALSE
else
set returnVal = TRUE
put file(mWriteString, data) into fileData -- return of 0 ==> OK
if fileData = 0 then
put file(mSetFinderInfo, "KIDS", "????") into fileData -- return of 0 ==> OK
else
set returnVal = FALSE
end if
file(mDispose)
return returnVal
end if
end