Skip to content

Commit

Permalink
增加RE_LIVE_PIPE_TMP_DIR环境变量读取 #162
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed Nov 13, 2023
1 parent 7983e2c commit 8fdb6bc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/N_m3u8DL-RE/CommandLine/CommandInvoker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace N_m3u8DL_RE.CommandLine
{
internal partial class CommandInvoker
{
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20231026";
public const string VERSION_INFO = "N_m3u8DL-RE (Beta version) 20231113";

[GeneratedRegex("((best|worst)\\d*|all)")]
private static partial Regex ForStrRegex();
Expand Down
5 changes: 5 additions & 0 deletions src/N_m3u8DL-RE/Util/OtherUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,5 +160,10 @@ public static async Task DeGzipFileAsync(string filePath)
if (File.Exists(deGzipFile)) File.Delete(deGzipFile);
}
}

public static string GetEnvironmentVariable(string key, string defaultValue = "")
{
return Environment.GetEnvironmentVariable(key) ?? defaultValue;
}
}
}
5 changes: 3 additions & 2 deletions src/N_m3u8DL-RE/Util/PipeUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public static bool StartPipeMux(string binary, string[] pipeNames, string output
string dateString = DateTime.Now.ToString("o");
StringBuilder command = new StringBuilder("-y -fflags +genpts -loglevel quiet ");

string? customDest = Environment.GetEnvironmentVariable("RE_LIVE_PIPE_OPTIONS");
string customDest = OtherUtil.GetEnvironmentVariable("RE_LIVE_PIPE_OPTIONS");
string pipeDir = OtherUtil.GetEnvironmentVariable("RE_LIVE_PIPE_TMP_DIR", Path.GetTempPath());

if (!string.IsNullOrEmpty(customDest))
{
Expand All @@ -67,7 +68,7 @@ public static bool StartPipeMux(string binary, string[] pipeNames, string output
command.Append($" -i \"\\\\.\\pipe\\{item}\" ");
else
//command.Append($" -i \"unix://{Path.Combine(Path.GetTempPath(), $"CoreFxPipe_{item}")}\" ");
command.Append($" -i \"{Path.Combine(Path.GetTempPath(), item)}\" ");
command.Append($" -i \"{Path.Combine(pipeDir, item)}\" ");
}

for (int i = 0; i < pipeNames.Length; i++)
Expand Down

0 comments on commit 8fdb6bc

Please sign in to comment.