Re: Setting permissions in existing files?
- From: Chipzz <chipzz ULYSSIS Org>
- To: Sudrien <sudrien fusemail com>
- Cc: gnome-vfs-list gnome org
- Subject: Re: Setting permissions in existing files?
- Date: Tue, 15 Feb 2005 12:38:22 +0100 (CET)
What you are trying to do is fundamnetally flawed since not all methods
support UNIX style permissions anyway, IMO.
On Sun, 13 Feb 2005, Sudrien wrote:
> From: Sudrien <sudrien fusemail com>
> Subject: Setting permissions in existing files?
>
> Ok, I'm using gnomemm. I have a dialogue with checkboxes that are filled
> according to a given files' permissions. What I currently have is at
> http://svn.berlios.de/viewcvs/darimasen/trunk/src/iconmodes.cpp?rev=22 ,
> if more details are needed.
>
> Now how do I change the permissions of a file? All the tests in the code
> below work, except for the try{} section. I am not finding anything to
> take the new Gnome::Vfs::FilePermissions.
>
> What can I do?
>
> -Sud.
>
>
>
>
> ------My Code------
>
> void
> DaIconModes::SetPermissionsDialogue::apply(Glib::RefPtr<Gnome::Vfs::FileInfo>
> info){
>
>
> Gnome::Vfs::FilePermissions permissions;
> //make sure I've got the stuff that doesn't change
> permissions = info->get_permissions();
>
>
> if(u_r->get_active()){
> std::cout << "+u_r ";
> }else{
> std::cout << "-u_r ";
> }
> if(u_w->get_active()){
> std::cout << "+u_w ";
> }else{
> std::cout << "-u_w ";
> }
> if(u_x->get_active()){
> std::cout << "+u_x ";
> }else{
> std::cout << "-u_x ";
> }
> std::cout << "\n";
> if(g_r->get_active()){
> std::cout << "+g_r ";
> }else{
> std::cout << "-g_r ";
> }
> if(g_w->get_active()){
> std::cout << "+g_w ";
> }else{
> std::cout << "-g_w ";
> }
> if(g_x->get_active()){
> std::cout << "+g_x ";
> }else{
> std::cout << "-g_x ";
> }
> std::cout << "\n";
> if(o_r->get_active()){
> (permissions & Gnome::Vfs::PERM_OTHER_READ) == 1;
> std::cout << "+o_r ";
> }else{
> (permissions & Gnome::Vfs::PERM_OTHER_READ) == 0;
> std::cout << "-o_r ";
> }
> if(o_w->get_active()){
> (permissions & Gnome::Vfs::PERM_OTHER_WRITE) == 1;
> std::cout << "+o_w ";
> }else{
> (permissions & Gnome::Vfs::PERM_OTHER_WRITE) == 0;
> std::cout << "-o_w ";
> }
> if(o_x->get_active()){
> (permissions & Gnome::Vfs::PERM_OTHER_EXEC) == 1;
> std::cout << "+o_x ";
> }else{
> (permissions & Gnome::Vfs::PERM_OTHER_EXEC) == 0;
> std::cout << "-o_x ";
> }
> std::cout << "\n\n";
>
>
> try{
> Gnome::Vfs::Handle::set_file_info(fullPath + info->get_name(),
> permissions, Gnome::Vfs::SET_FILE_INFO_PERMISSIONS);
> }
> catch(const Gnome::Vfs::exception& ex){
> std::cout << "Could not change permissions.\n";
> }
>
>
> hide();
> _______________________________________________
> gnome-vfs-list mailing list
> gnome-vfs-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-vfs-list
>
Chipzz AKA
Jan Van Buggenhout
--
------------------------------------------------------------------------
UNIX isn't dead - It just smells funny
Chipzz ULYSSIS Org
------------------------------------------------------------------------
"Baldric, you wouldn't recognize a subtle plan if it painted itself pur-
ple and danced naked on a harpsicord singing 'subtle plans are here a-
gain'."
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]