Yes - I mentioned excluding the excluded view entries (–//depot/etc), I didn’t see parsing that as an issue.
For the sake of clarity I’ll explain my line of thinking a bit more, so there will be more to tear apart
From the question and comments I thought Sune was trying to do something rather simple:
[ul]
Determine if an existing file was in Perforce (for exporting an FBX and overwriting one that already exists)
Determine if a potential file that doesn’t exist yet (but is being exported) would be within Perforce clientspec (for exporting a new FBX that is valid to be added to Perforce)
[/ul]
Along with that, Sune mentioned assuming the default workspace and says:
“[…] Actually for a technical reason, I need to know this before exporting any files, that’s why I can’t rely on something like “add” failing with relevant error message).”
As such, I assumed that Sune simply wants to know if the export file path would be valid for adding to Perforce, but was unable to use the ‘add’ command prior to exporting as the export needs to be prevented.
So I frame the question this way:
I need to know if running ‘p4 add’ on a given file (which may not exist yet) will fail or succeed, but I need to know it without actually running ‘p4 add’
For my simple solution, any file path (or potential file path) which is under the root, and not being excluded, would therefore be a valid location (regardless of how the directories are overlaid - it doesn’t need to be a specific location, just a valid location). All that seems to matter is:
[ul]
Is the potential file path under the client root.
Is the potential file path not explicitly being excluded.
[/ul]
As an alternate solution that felt more hacky but is probably just as bad/good:
[ul]Prior to export, create a dummy file with the potential export name, and attempt to add it. If it adds, let the export go through and overwrite it. If it fails, throw the specific error and refuse the export.[/ul]
That was my line of thinking, for better or worse
Phil