Trying to get the user home

This commit is contained in:
FUH22860 2022-12-05 18:08:45 +01:00
parent 763de0a371
commit 9c05f3ac83
2 changed files with 22 additions and 11 deletions

View File

@ -1,12 +1,19 @@
using System.Diagnostics; using System.Diagnostics;
string homePath;
if(Environment.OSVersion.Platform == PlatformID.Unix) {
homePath = Environment.GetEnvironmentVariable("HOME");
} else {
Console.WriteLine("This script doesn't support your operating system.");
}
Process process = new Process(); Process process = new Process();
ProcessStartInfo processStartInfo = new ProcessStartInfo(); ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.WindowStyle = ProcessWindowStyle.Hidden; //processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
processStartInfo.FileName = @"ls"; processStartInfo.FileName = @"yay";
processStartInfo.WorkingDirectory = @"/home/andre"; //processStartInfo.WorkingDirectory = homePath;
processStartInfo.Arguments = "--color"; //processStartInfo.Arguments = "--color";
processStartInfo.RedirectStandardOutput = false; processStartInfo.RedirectStandardOutput = false;
processStartInfo.RedirectStandardError = false; processStartInfo.RedirectStandardError = false;
processStartInfo.UseShellExecute = true; processStartInfo.UseShellExecute = true;

View File

@ -3,6 +3,10 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<PublishReadyToRun>true</PublishReadyToRun>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
</PropertyGroup> </PropertyGroup>