Skip to content

added CopyFile() to P4Shell#2

Open
im1dermike wants to merge 1 commit into
inorton:masterfrom
im1dermike:master
Open

added CopyFile() to P4Shell#2
im1dermike wants to merge 1 commit into
inorton:masterfrom
im1dermike:master

Conversation

@im1dermike

Copy link
Copy Markdown

No description provided.

@im1dermike

Copy link
Copy Markdown
Author

Hoping I did this right. It's the first time I've collaborated on github. ;)

@im1dermike

Copy link
Copy Markdown
Author

Actually, the following will allow for spaces in the filenames:

public bool CopyFile(string localPath, string depotPath)
{
var result = false;
var stdout = String.Empty;
if (!loggedIn)
Login();
var stringifiedLocalPath = String.Format(""{0}"", localPath);
var stringifiedDepotPath = String.Format(""{0}"", depotPath);
try
{
env.ExecuteThrow("p4", new string[] { "print", "-o", stringifiedLocalPath, stringifiedDepotPath }, out stdout);
var fileInfo = new FileInfo(localPath);
fileInfo.IsReadOnly = false;
result = true;
}
catch (ApplicationException e)
{
Console.Error.WriteLine(e.Message);
}
return result;
}

@inorton

inorton commented Mar 18, 2015

Copy link
Copy Markdown
Owner

so sorry it took me so long!

Comment thread p4mono/P4Shell/P4Shell.cs

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indenting is a bit mixed up. Also this wont work so well if the line endings in the client are wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants