Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Proper way to change file permissions in installed files after a bundle install?
Proper way to change file permissions in installed files after a bundle install? [message #534600] Wed, 19 May 2010 15:21 Go to next message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
I've seen a small amount of traffic on this subject in the past, but
nothing current and definitive.

*** For a project that doesn't use PDE Build, ***

What is the proper, maximally platform-independent way to alter
the permissions of a file that is installed as part of a bundle
in Eclipse 3.4 and 3.5?

[Bonus points if the technique also works for Eclipse 3.3.]

The bundle has been marked "expand-on-install", so the file will
really exist on the file system by the time the main part of the
install process has completed.

--
Cheers,
-- Bob

--------------------------------
Robert M. Fuhrer
Research Staff Member
Programming Technologies Dept.
IBM T.J. Watson Research Center

IDE Meta-tooling Platform Project Lead (http://www.eclipse.org/imp)
X10: Productive High-Performance Parallel Programming (http://x10.sf.net)
Re: Proper way to change file permissions in installed files after a bundle install? [message #537510 is a reply to message #534600] Wed, 02 June 2010 16:59 Go to previous message
Robert M. Fuhrer is currently offline Robert M. FuhrerFriend
Messages: 294
Registered: July 2009
Senior Member
Ok, no responses, so far, so let's try this approach instead.

Here's some EFS-based code I came up with that's completely portable:

String path = <filesystem-absolute path to executable>;

IFileSystem fs = EFS.getLocalFileSystem();
IFileStore fStore= fs.getStore(new Path(path));
IFileInfo fInfo= fStore.fetchInfo();

if (! fInfo.getAttribute(EFS.ATTRIBUTE_EXECUTABLE)) {
fInfo.setAttribute(EFS.ATTRIBUTE_EXECUTABLE, true);
try {
fStore.putInfo(fInfo, EFS.SET_ATTRIBUTES, null);
} catch (CoreException e) {
logException("Exception encountered when attempting to fix file permissions", e);
}
}

Anyone see anything wrong with this? It seems to work.

On the other hand, it also appears that, on Mac OS, it only sets the owner's permissions (not group or world). I guess it's not entirely unreasonable for the user to have to set the group/world execute bit outside Eclipse.
Previous Topic:commonWizard shortcut appears only in Project Explorer, not Package Explorer
Next Topic:how to associate with View and the Editor of GEF
Goto Forum:
  


Current Time: Sat Apr 20 00:11:22 GMT 2024

Powered by FUDForum. Page generated in 0.03297 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top