Thanks Franz, and to be more specific ...
You have to be VERY VERY careful with Java Files. Example: File a = new File("./foo/../Foo.bar"); File b = new File("Foo.bar"); System.out.println(a.getPath()); // -> .\foo\..\Foo.bar System.out.println(a.getAbsolutePath()); // -> Z:\java\eclipse\saros\Test\.\foo\..\Foo.bar // this call would actually also resolve symbolic links etc. System.out.println(a.getCanonicalPath()); // -> Z:\java\eclipse\saros\Test\Foo.bar System.out.println(b.getPath()); // -> Foo.bar System.out.println(b.getAbsolutePath()); // -> Z:\java\eclipse\saros\Test\Foo.bar System.out.println(b.getCanonicalPath()); // -> Z:\java\eclipse\saros\Test\Foo.bar System.out.println(a.equals(b)); // -> false ! On 21.08.2014 14:48, Zieris, Franz wrote: > Just to make this clear: > >> No, see GIT for example, >> My workspace is in Z:\java\eclipse\saros >> >> The relative workspace path inside Eclipse is: >> saros\src\...\SarosSession.java >> >> Unfortunately the absolute path is NOT: >> Z:\java\eclipse\saros\saros\src\...\SarosSession.java > This is not due to Git, but due to the Eclipse option of storing your files > outside the "default location", i.e. the workspace folder (plus the > possibility of having "linked files"). > But this does not weaken your point. > In fact, this should make clear that every Eclipse user (not only the > Git-infected ones) can be affected. > > Franz > > > -----Original Message----- > From: Stefan Rossbach [mailto:srossb...@arcor.de] > Sent: Thursday, August 21, 2014 2:24 PM > To: Holger Schmeisky; dpp-devel@lists.sourceforge.net > Subject: Re: [DPP-Devel] Projecthandles in Eclipse > > On 21.08.2014 08:54, Holger Schmeisky wrote: >> Hi, >> >> I would like to refactor the IProject implementation in Saros/I and have >> a few questions about how the Resources API works in Eclipse: >> >> * Is ResourcesPlugin.getWorkspace().getRoot() the best way to get at >> the workspace? > It is the only way, maybe some other static methods but the result would > be the same >> - If yes, We will need a unified mechanism for getting projects >> from somewhere >> - Should it have static methods? In that case I dont know how to >> implement it :-) >> - otherwise I would suggest and interface + adding the >> implementation to PicoContainer >> * Would it work to mimick the IProject.getFile() and .getFolder() >> behaviour of creating handles by using the io.File API? (If we assume we >> always work on files and not something exotic) > No, see GIT for example, > My workspace is in Z:\java\eclipse\saros > > The relative workspace path inside Eclipse is: > saros\src\...\SarosSession.java > > Unfortunately the absolute path is NOT: > Z:\java\eclipse\saros\saros\src\...\SarosSession.java > > But: > Z:\git_repository\saros\de.fu_berlin.inf...\....\SarosSession.java >> - I currently see no reason against it, because File creates >> handles too and actual files are only created when IFile.create() is called. > Can you please describe your problem what is wrong with the current > interfaces ? >> Regards, >> Holger >> > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > DPP-Devel mailing list > DPP-Devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dpp-devel ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ DPP-Devel mailing list DPP-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dpp-devel