defaultFolder |
Type | property |
Dictionary | LCS |
Library | LiveCode Script |
Syntax | set the defaultFolder to <folderPath>
|
Synonyms | folder,directory |
Summary | Specifies the folder that is used by the files and folders
functions and by commands that manipulate files.
|
Introduced | 1.0 |
OS | mac, windows, linux, ios, android |
Platforms | desktop, server, mobile |
Example | set the defaultFolder to "/Applications/GetIt"
set the defaultFolder to "C:/Program Files/GetIt"
set the itemDelimiter to slash
get the effective filename of this stack
set the defaultFolder to item 1 to -2 of it
|
Values | Name | Type | Description |
---|
The result | | 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.
|
Value | | The defaultFolder is a string consisting of a valid path
to a folder. When a LiveCode 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 (e.g. 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.
|
|
Related | Keyword: effective, it, item
Property: itemDelimiter, stackFiles
Constant: slash
Command: create alias, revSetDatabaseDriverPath
Function: files, folders, result
Glossary: absolute file path, command, current folder, file, file path, folder, function, Mac OS, prepend, property, relative file path, string, Unix, value, Windows
|
Description | Use the defaultFolder to perform file manipulations on files in
the same folder without having to include the fullpath.
The defaultFolder property specifies the folder LiveCode 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, LiveCode looks for
the file in the defaultFolder. If you specify a relative path, the defaultFolder is prepended to it to
create the full path.
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.
Note: When setting the defaultFolder, any trailing slash will be
removed. For example:
set the defaultFolder to /Users/John/
put the defaultFolder
|
Tags | file system |