Error getting tags :
error 404Error getting tags :
error 404 defaultFolder | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
defaultFolder
Basics
Expander triangle
Type
Property
Syntax

set the defaultFolder to folderPath

Introduced
1.0
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Specifies the folder that is used by the files and folders functions and by commands that manipulate files.
Examples

set the defaultFolder to "/Hard Disk/Applications/GetIt"
set the defaultFolder to it

Additional Comments
Expander triangle

Use the defaultFolder to perform file manipulations on files in the same folder without having to include the full path.

Value:

The defaultFolder is a string consisting of a valid path to a folder.

When a Revolution application starts up, the defaultFolder initially contains whatever the working directory was at the time the application was launched. Typically this is the folder that the application resides in, however this is not always the case and shouldn't be relied on. It is best always to set the defaultFolder before using relative paths.

When you start up the application via a file association (eg by launching a document you have chosen to link to your application using "Open With..." on Windows or by dragging the document onto the application icon on OS X ) then the defaultFolder is set to the folder containing the document being launched.

Comments:

The defaultFolder property specifies the folder Revolution uses as the current directory when resolving relative paths (except for relative paths specified in the stackFiles property).

If you specify a file without giving its full path, Revolution looks for the file in the defaultFolder. If you specify a relative path, the defaultFolder is prepended to it to create the full path.

If you set the defaultFolder to a folder that doesn't exist, the result is set to "can't open directory" and the value of the defaultFolder does not change.

You cannot delete the current defaultFolder.

Important! The folderPath is specified using Unix conventions, even on Mac OS and Windows systems. The names of folders are separated with a "/" character, and absolute paths (starting with a disk or partition name) must begin with a "/" character.

User Comments
Expander triangle
User thumbnail
Devin Asay
StarStarStarStarStar
Feb 3, 2009
When executed in the development environment, this routine will set the defaultFolder to the folder in which the referenced stack resides (the stack must have already been saved to disk for this to work):


set the itemDelimiter to slash
get the effective filename of this stack
set the defaultFolder to item 1 to -2 of it

You can insert this code into the preOpenStack or openStack handler, and be assured that any files that reside in the same folder as the stack can be accessed by using the relative path to the file. Important Mac OS X note: If you run this code in a stack saved as a standalone application, the defaultFolder will be set to a folder inside the application bundle; namely, ApplicationName.app/Contents/MacOS. If you do not explicitly set the defaultFolder in the standalone, it will be set to the folder containing the application bundle, as noted above.
User thumbnail
rodney@oceanbrowser.com
StarStarStarStarStar
Jun 9, 2010
Note that
set directory to empty put the directory -- returns "/"
Is equivalent on Mac to set directory to "/" (ie put the folders would return the folders at the top level of your hard drive)
if you are setting the directory prior to checking contents of a folder be sure to chk folder exists:
   if not (there is a folder pFolder) then            answer error "Input folder does not exist"

If you are