- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable
SignBinary
with PathTooLong
path.
- 1.9.2
- 1.9.2-beta.1
- 1.9.2-beta
- 1.9.2-alpha
- 1.9.1
- 1.9.1-alpha
- 1.9.0
- 1.9.0-rc.2
- 1.9.0-rc.1
- 1.9.0-rc
- 1.9.0-beta.9
- 1.9.0-beta.8
- 1.9.0-beta.7
- 1.9.0-beta.6
- 1.9.0-beta.5
- 1.9.0-beta.4
- 1.9.0-beta.3
- 1.9.0-beta.2
- 1.9.0-beta.1
- 1.9.0-beta
- 1.9.0-alpha.12
- 1.9.0-alpha.11
- 1.9.0-alpha.10
- 1.9.0-alpha.9
- 1.9.0-alpha.8
- 1.9.0-alpha.7
- 1.9.0-alpha.6
- 1.9.0-alpha.5
- 1.9.0-alpha.4
- 1.9.0-alpha.3
- 1.9.0-alpha.2
- 1.9.0-alpha.1
- 1.9.0-alpha
- 1.8.2
- 1.8.2-rc
- 1.8.2-beta.2
- 1.8.2-beta.1
- 1.8.2-beta
- 1.8.2-alpha
- 1.8.1
- 1.8.1-beta.1
- 1.8.1-beta
- 1.8.1-alpha.1
- 1.8.1-alpha
- 1.8.0
- 1.8.0-alpha.1
- 1.8.0-alpha
- 1.7.4
- 1.7.4-alpha
- 1.7.3
- 1.7.3-alpha
- 1.7.2
- 1.7.2-beta
- 1.7.2-alpha
Showing
4 changed files
with
120 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System; | ||
using System.IO; | ||
|
||
namespace ricaun.Nuke.Extensions | ||
{ | ||
/// <summary> | ||
/// PathTooLongUtils | ||
/// </summary> | ||
public class PathTooLongUtils | ||
{ | ||
/// <summary> | ||
/// MAX_PATH | ||
/// </summary> | ||
public const int MAX_PATH = 260; | ||
/// <summary> | ||
/// FileMoveToTempUtils | ||
/// </summary> | ||
public class FileMoveToTemp : IDisposable | ||
{ | ||
private readonly string filePath; | ||
private string tempFilePath; | ||
/// <summary> | ||
/// FileMoveToTempUtils | ||
/// </summary> | ||
/// <param name="filePath"></param> | ||
public FileMoveToTemp(string filePath) | ||
{ | ||
this.filePath = filePath; | ||
Initialize(); | ||
} | ||
|
||
private void Initialize() | ||
{ | ||
if (IsPathTooLong()) | ||
{ | ||
tempFilePath = Path.Combine(Path.GetTempPath(), Path.GetFileName(this.filePath)); | ||
File.Move(this.filePath, tempFilePath, true); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// GetFilePathLong | ||
/// </summary> | ||
/// <returns></returns> | ||
public int GetFilePathLong() | ||
{ | ||
return GetFilePath().Length; | ||
} | ||
|
||
/// <summary> | ||
/// Check if path is too long | ||
/// </summary> | ||
/// <returns></returns> | ||
public bool IsPathTooLong() | ||
{ | ||
return GetFilePathLong() > MAX_PATH; | ||
} | ||
|
||
/// <summary> | ||
/// GetFilePath | ||
/// </summary> | ||
/// <returns></returns> | ||
public string GetFilePath() | ||
{ | ||
return tempFilePath ?? filePath; | ||
} | ||
|
||
/// <summary> | ||
/// Dispose | ||
/// </summary> | ||
public void Dispose() | ||
{ | ||
if (tempFilePath is null) | ||
return; | ||
|
||
File.Move(tempFilePath, filePath, true); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters