add a path parameter to the files and folders functions
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, LCMark
add a path parameter to the files and folders functions
Hi
Do others think it would be useful to add a relative/absolute path parameter to the files and the folders functions? Personally I think it would be nice not to need to mess with the folder all the time.
Cheers
Monte
Do others think it would be useful to add a relative/absolute path parameter to the files and the folders functions? Personally I think it would be nice not to need to mess with the folder all the time.
Cheers
Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: add a path parameter to the files and folders functions
Hi Monte,
Does this mean get rid of (or not having to use) "put the effective filename of this stack..."
If yes, then I'm all for it!
Simon
Does this mean get rid of (or not having to use) "put the effective filename of this stack..."
If yes, then I'm all for it!
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: add a path parameter to the files and folders functions
It means not having to:
Code: Select all
put the folder into tCurrentFolder
set the folder to tSomeOtherFolder
-- do something with the files or folders
set the folder to tCurrentFolder
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
Re: add a path parameter to the files and folders functions
YES, I want that!monte wrote:It means not having to:Code: Select all
put the folder into tCurrentFolder set the folder to tSomeOtherFolder -- do something with the files or folders set the folder to tCurrentFolder
Maybe something like this:
...
put the files of folder "path/to/folder" into tFiles
...
Re: add a path parameter to the files and folders functions
I think functions can only have one parameter in the "the... of..." form. So it would just be:
Code: Select all
put the files of "path/to/folder"
or
put files("path/to/folder")
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: add a path parameter to the files and folders functions
...until we arrive in a saner world where using "sometimes" rules allowing function calls with property syntax is disallowed (sorry, HyperCard team, you screwed up there. <g>).monte wrote:I think functions can only have one parameter in the "the... of..." form...
More seriously, as long as we're exploring ways to avoid having to change the directory to file operations, perhaps we could have some means of obtaining the "detailed files" info for a single file in one line?
e.g.:
get fileInfo(tSomeFilePath)
...would return an array with the elements currently included in the items of "the detailed files".
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: add a path parameter to the files and folders functions
Well arguably the files of a folder is a property of the folder so it works sometimes...
I like your idea of a function for details. Returning an array also means there's no need to urlEncode the name.
I like your idea of a function for details. Returning an array also means there's no need to urlEncode the name.
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: add a path parameter to the files and folders functions
I think you may have the add the companion functions:
and I have mixed feelings about returning detailed info in an array. What would the structure look like (assuming a hash rather than a numeric array)? This gets messy cross-platform.
Code: Select all
put the [detailed] files of <pathToFolder>
put the [detailed] folders of <pathToFolder>
put the fileInfo of <pathToFile>
put the folderInfo of <pathToFolder>
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
-
- VIP Livecode Opensource Backer
- Posts: 9802
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: add a path parameter to the files and folders functions
IIRC there are 11 items in each line returned from "the detailed files", all but the last of which (Mac creator and type code) are currently provided for all platforms.mwieder wrote:and I have mixed feelings about returning detailed info in an array. What would the structure look like (assuming a hash rather than a numeric array)? This gets messy cross-platform.
The keys could be:
name
size
resourceSize (Mac only; 0 for all others, as it is now)
created
modified
accessed
backedup
permissions
owner
group
creatortype
The only value I would change from its form in "the detailed files" would be the name - in "the detailed files" it's URL encoded only to prevent commas from mucking with parsing, and it would simplify things if the file name were provided as-is.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: add a path parameter to the files and folders functions
Cool. That looks pretty clean to me.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
Re: add a path parameter to the files and folders functions
What about fileDetails?
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/
-
- VIP Livecode Opensource Backer
- Posts: 3581
- Joined: Mon Jan 22, 2007 7:36 am
- Location: Berkeley, CA, US
- Contact:
Re: add a path parameter to the files and folders functions
fileDetails is good by me. I also like the fact that returning an array allows for flexibility in terms of adding more details in the future as appropriate without breaking the way the function works.
PowerDebug http://powerdebug.ahsoftware.net
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev
PowerTools http://www.ahsoftware.net/PowerTools/PowerTools.irev