[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] URLs, URIs, and IDs (oh my)

Hi Jeff,

Jeff McAffer wrote:
I'm thinking of something that would be equivalent to
foo(IPath path) {
   path = path.removeLastSegments(2);
   path = path.append("foo");
   path = path.addFileExtension(".txt");
   File file = path.toFile();
   OutputStream out = new FileOutputStream(file);
}

Many of the usecases don't really involve ECF at all (parish the thought :-).

That's good! (at least for ECF anyway :)

In the broader Equinox/Eclipse context what we need is generic, handy and effcinet ways of manipulating path-like structures. Sometimes they are for files, sometimes URL-like things, ... The real challenge in this space is in encoding and all the UNC/platform whackiness and the conversion between the different forms (e.g., new URL(<unc string>).getPath() does not give you what yoy might hope for).
How do you see IDs fitting in? Would the adapter facility allow people to convert between the different forms?

In a word, 'yes'.

e.g.
IPath path = (IPath) fileID.getAdapter(IPath.class);
// call foo above

Scott