Skip to content

Commit

Permalink
[Bug Fix] Unicode folder support in which SymlinkCreator executable s…
Browse files Browse the repository at this point in the history
…tored (fixes #15)
  • Loading branch information
arnobpl committed Sep 12, 2024
1 parent 093da27 commit 3d80ad2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions SymlinkCreator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("1.2.7")]
[assembly: AssemblyFileVersion("1.2.7")]
[assembly: AssemblyVersion("1.2.8")]
[assembly: AssemblyFileVersion("1.2.8")]
Binary file modified SymlinkCreator/_ReadMe/Screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions SymlinkCreator/core/ScriptExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class ScriptExecutor : StreamWriter
public ScriptExecutor(string fileName) : base(fileName)
{
this._fileName = fileName;
AddUnicodeSupport(this);
}

#endregion
Expand Down Expand Up @@ -73,6 +74,7 @@ public void ExecuteAsAdmin()
private void CreateWrapperScript(string wrapperScriptFileName, string stderrFileName)
{
StreamWriter wrapperScriptStreamWriter = new StreamWriter(wrapperScriptFileName);
AddUnicodeSupport(wrapperScriptStreamWriter);
// redirect error output to file
wrapperScriptStreamWriter.WriteLine(
"\"" + Path.GetFullPath(this._fileName) + "\" 2> \"" + Path.GetFullPath(stderrFileName) + "\"");
Expand All @@ -98,6 +100,12 @@ private void ExecuteWrapperScript(string wrapperScriptFileName, string stderrFil
}
}

private void AddUnicodeSupport(StreamWriter streamWriter)
{
// set code page to UTF-8 to support unicode file paths
streamWriter.WriteLine("chcp 65001 >NUL");
}

#endregion
}
}
3 changes: 0 additions & 3 deletions SymlinkCreator/core/SymlinkAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ private ScriptExecutor PrepareScriptExecutor(string scriptFileName)
{
ScriptExecutor scriptExecutor = new ScriptExecutor(scriptFileName);

// set code page to UTF-8 to support unicode file paths
scriptExecutor.WriteLine("chcp 65001 >NUL");

// go to destination path
scriptExecutor.WriteLine(_splittedDestinationPath[0]);
scriptExecutor.WriteLine("cd \"" + _destinationPath + "\"");
Expand Down

0 comments on commit 3d80ad2

Please sign in to comment.