Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » file.exists() problem
file.exists() problem [message #88212] Thu, 03 July 2003 11:50 Go to next message
Eclipse UserFriend
Originally posted by: bob.donovan.eds.com

Hi,

I am creating an IFile in my project directory. The file is being created
during the shutdown of the plugin in order to save some data. The file
save is triggered by my Plugin's class .shutdown() method.

When I start the Eclipse session again, I attempt to read the file. First
I check to see if the file exists with file.exists(). But this reports
false everytime even though the file is physically in the project
directory.

I am guessing that the file is not registered with the project since it is
being created on shutdown. How do I get around this? How do I get it so
that the file does exists?

Bob
Re: file.exists() problem [message #88617 is a reply to message #88212] Thu, 03 July 2003 18:09 Go to previous message
Eclipse UserFriend
Originally posted by: John_Arthorne.oti.com_

Yes, the problem is that you're writing the file in your plugin
shutdown. Plugin shutdown occurs after the workspace is saved, so it's
too late to add files at this point. Try registering yourself as a
workspace save participant and write your files there.

@see IWorkspace#save
@see IWorkspace#addSaveParticipant

Alternatively, you will have to refreshLocal on the file after startup
to make the workspace aware of its existence.
--

Bob Donovan wrote:
> Hi,
>
> I am creating an IFile in my project directory. The file is being created
> during the shutdown of the plugin in order to save some data. The file
> save is triggered by my Plugin's class .shutdown() method.
>
> When I start the Eclipse session again, I attempt to read the file. First
> I check to see if the file exists with file.exists(). But this reports
> false everytime even though the file is physically in the project
> directory.
>
> I am guessing that the file is not registered with the project since it is
> being created on shutdown. How do I get around this? How do I get it so
> that the file does exists?
>
> Bob
>
Previous Topic:ImageRegistry and Resource Management
Next Topic:Error: "active editor does not contain a main type"
Goto Forum:
  


Current Time: Sun May 04 10:45:22 EDT 2025

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

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

Back to the top