Added support for symbolic links on non-Windows platforms.

This commit is contained in:
2017-08-22 18:05:18 +01:00
parent a874eb48a3
commit a2b6c4a828
7 changed files with 261 additions and 51 deletions

View File

@@ -366,29 +366,11 @@ namespace osrepodbmgr.Core
#endif
long counter = 0;
string format = null;
bool isLink = false;
JsonTextReader jsReader = new JsonTextReader(new StringReader(lsarOutput));
while(jsReader.Read())
{
if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "XADFileName")
counter++;
else if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "XADIsLink")
{
jsReader.Read();
if(jsReader.TokenType == JsonToken.Integer)
isLink = int.Parse(jsReader.Value.ToString()) > 0;
}
else if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "XADIsHardLink")
{
jsReader.Read();
// TODO: Support symlinks, devices, hardlinks, whatever?
if(jsReader.TokenType == JsonToken.Integer && isLink && int.Parse(jsReader.Value.ToString()) == 0)
{
if(Failed != null)
Failed("Archive contains unsupported symbolic links, not continuing.");
return;
}
}
else if(jsReader.TokenType == JsonToken.PropertyName && jsReader.Value != null && jsReader.Value.ToString() == "lsarFormatName")
{
jsReader.Read();
@@ -637,6 +619,13 @@ namespace osrepodbmgr.Core
return;
}
if(dbCore.DBOps.HasSymlinks(Context.dbInfo.id))
{
if(Failed != null)
Failed("Cannot create symbolic links on ZIP files");
return;
}
if(!Context.usableDotNetZip)
{
if(Failed != null)