Lasso 9 File Manipulation
Creating a new directory with a file inside an existing directory is
relatively easy...
// Set permissions without database query
inline(#permissions, -nothing) => {
// Create a directory to store the file
local('dir' = dir(#path))
#dir->create
if(#dir->exists) => {
// Save file and overwrite if necessary
local(my_file) = file(#path_andFilename)
#my_file->doWithClose => {
#my_file->openWriteOnly
#my_file->writeString(#file_content)
}
}
However, a problem appears when the new directory and file do not have the
same sharing (owner, group, everyone) and permissions (read, write, execute)
as the original directory.
I tried changing the way I created the file object using:
// Open a file for creation, and reading and writing
local(my_file) = file($sess_pathto_htmlFile, integer_bitOr(io_file_o_creat,
io_file_o_rdwr))
But that didn't change the situation, so I tried [filedesc->fchmod] to
change the unix file permissions of the file using the sample code in
LassoDocs:
local(change_filePermissions) = file(#path_andFilename);
#change_filePermissions->fchmod: '0777'; // using octal notation
And I get an error message, "FAILURE: -9948 Definition Not Found:
file->fchmod(string)". So then I modified the second line of code to the
Lasso 9 syntax I'm familiar with:
#change_filePermissions->fchmod('0777')
And I get the same error message.
How do I create the new directory and file using the same sharing and
permissions as the original directory, or how do I modify the two after
creation so that I can read and write to them?
Thanks.
--
View this message in context: http://lasso.2283332.n4.nabble.com/Lasso-9-File-Manipulation-tp4637330.html
Sent from the Lasso - Talk mailing list archive at Nabble.com.
#############################################################
This message is sent to you because you are subscribed to
the mailing list Lasso
Lasso@lists.lassosoft.com
To unsubscribe, E-mail to: <Lasso-unsubscribe@lists.lassosoft.com>
Send administrative queries to <Lasso-request@lists.lassosoft.com>
Feb 10, 2013; 09:56
Kyle Jessup
Re: Lasso 9 File Manipulation
Feb 12, 2013; 23:59
Kim Vandenbroek
Fwd: Lasso 9 File Manipulation
Feb 13, 2013; 09:43
Kyle Jessup
Re: Lasso 9 File Manipulation