Trying this:
var path = $"{filePath}@{fileLabel}";
var dloc = new DepotPath(path);
var opts = new GetFileContentsCmdOptions(GetFileContentsCmdFlags.Suppress, null);
var file = p4repo.GetFileContents(opts, dloc);
I always get an empty file back even though I've verified the 'path' using "p4 print" from the command line. Note that the string in 'path' is something like '//source/things/stuff/that_file_I_need.txt@our_p4_label_2021_5_8'.
However, if I use '//source/things/stuff/that_file_I_need.txt' (omitting the @label part) for the value of 'path' then execution returns the contents of the file in the tip of the depot. This is not the version of the file I want obviously. I simply can't figure out (or find) how to get the file at a selected label (@) OR at a specific version (#). These are the common p4 conventions for doing such.
Anyone know the answer here? Thanks in advance!
Construct the filespec with a PathSpec
and VersionSpec
rather than concatenating a string together: