Proper way to change file permissions in installed files after a bundle install? [message #534600] |
Wed, 19 May 2010 11:21  |
Eclipse User |
|
|
|
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 12:59  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.03073 seconds