Before I re-invent the wheel, I would like to know if anyone has previously created a library to parse and/or create a Perforce File Specification (http://www.perforce.com/perforce/doc.current/manuals/cmdref/filespecs.html) in some library either in C++ or C#. I'd like to perform various operations like:

  • Optimize client spec (remove unneeded -/+ that are superfluous) and sort it
  • Create a client spec based on 'have' list
  • Add/remove new directories or file lists

The motivation is to make managing client specs automatic through a front-end tool. There is a decent editor in P4V, but in most cases I can generate the client spec for people in my company to make things easier.

One example would be to pass in a client spec something like:

//depot/Release/HEAD/... //joel.van.eenwyk_dev/HEAD/...
-//depot/Release/HEAD/Test/... //joel.van.eenwyk_dev/HEAD/Test/...
-//depot/Release/HEAD/Docs/... //joel.van.eenwyk_dev/HEAD/Docs/...
//depot/Release/HEAD/Docs/... //joel.van.eenwyk_dev/HEAD/Docs/...

And it would automatically optimize it to:

//depot/Release/HEAD/... //joel.van.eenwyk_dev/HEAD/...
-//depot/Release/HEAD/Test/... //joel.van.eenwyk_dev/HEAD/Test/...

I'm looking for an open-source solution that does not cost anything. My target platform is Windows, but happy to port code over from other platforms.

  • Would you mind posting a short example file, just to make sure your question is extra-clear for everyone? Thanks! – Nicolas Raoul Dec 7 '15 at 22:52
  • Also, do you have any license or price preference? And is it OK for the library to rely on OS-specific things? – Nicolas Raoul Dec 7 '15 at 22:53
  • Thanks for the comments! I added an example and my open source requirement. – Joel Van Eenwyk Dec 8 '15 at 0:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.