home *** CD-ROM | disk | FTP | other *** search
- property mainPath, oldPath, currentPath, newPath, directory, theFile, theFolder, delim, pathToFile, fileToCopy, contentList, lineOffset
-
- on new me, gDelim, thePath, theDirectory
- set delim to gDelim
- set mainPath to thePath
- set currentPath to mainPath
- set directory to theDirectory
- set lineOffset to 0
- return me
- end
-
- on setFile_Folder me
- set folderName to directory
- set fileName to directory & ".tx`"
- setPath(me, folderName, fileName)
- put folderName into field "display1"
- put lookup(me) into field "display2"
- end
-
- on setPath me, folderName, fileName
- set newPath to currentPath & folderName & delim
- set theFile to fileName
- set pathToFile to newPath & fileName
- put newPath into field "path"
- set currentPath to newPath
- end
-
- on lookup me
- set text1 to EMPTY
- set tempFiles to []
- set tempFolders to []
- sort(tempFiles)
- sort(tempFolders)
- repeat with n = 1 to the maxinteger
- set file to getNthFileNameInFolder(newPath, n)
- if file = EMPTY then
- exit repeat
- end if
- if file = theFile then
- next repeat
- next repeat
- end if
- set the itemDelimiter to "."
- if the number of items in file > 1 then
- add(tempFiles, file)
- next repeat
- end if
- add(tempFolders, file)
- end repeat
- set lineOffset to count(tempFolders)
- repeat with i = 1 to count(tempFolders)
- put getAt(tempFolders, i) & RETURN after text1
- end repeat
- repeat with i = 1 to count(tempFiles)
- put getAt(tempFiles, i) & RETURN after text1
- end repeat
- return text1
- end
-
- on goBackOneLevel me
- set the itemDelimiter to delim
- set i to the number of items in currentPath
- delete item i - 1 to i of currentPath
- set oldPath to currentPath & delim
- if oldPath = mainPath then
- goMenu()
- end if
- set folderName to item i - 2 of currentPath
- set theFile to folderName & ".tx`"
- set pathToFile to oldPath & theFile
- set currentPath to oldPath
- set newPath to oldPath
- put folderName into field "display1"
- put lookup(me) into field "display2"
- makeDescriptionList()
- put currentPath into field "path"
- put EMPTY into field "description"
- end
-
- on makeDescriptionList me
- set file to new(xtra("FileIO"))
- set txtFile to pathToFile
- openFile(file, txtFile, 1)
- set tempText to " "
- set description to []
- set tempText to readFile(file)
- if voidp(tempText) then
- return
- end if
- repeat with i = 1 to the number of lines in tempText
- if i = 1 then
- set aLine to line i of tempText
- add(description, aLine)
- next repeat
- end if
- set aLine to line i of tempText
- delete char 1 of aLine
- add(description, aLine)
- end repeat
- closeFile(file)
- set file to 0
- return description
- end
-
- on copyFile me
- if not (fileToCopy contains ".") then
- return
- end if
- set NameOfFile to currentPath & fileToCopy
- if NameOfFile = currentPath then
- return
- end if
- set file to new(xtra("FileIO"))
- set fileToDisk to displaySave(file, "Choose a destination for:", fileToCopy)
- set fileFromCD to NameOfFile
- if fileToDisk = EMPTY then
- return
- else
- if the machineType = 256 then
- openXLib("ProgCopy.x32")
- else
- openXLib("ProgressCopy Xtra (FAT)")
- end if
- set pcObj to new(xtra("ProgressCopy"), 1, 1, 1)
- copyFile(pcObj, fileFromCD, fileToDisk, 1, 1, 1)
- set pcObj to 0
- set file to 0
- end if
- end
-