Skip to content

Commit

Permalink
Remove domain to user name
Browse files Browse the repository at this point in the history
  • Loading branch information
fredatgithub committed Mar 15, 2019
1 parent 8d19ae0 commit 91d55f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions SaveWin10Pictures/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ private static void Main()
List<string> files = new List<string>();
int counter = 0;
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
// remove domain if any
if (userName.Contains("\\"))
{
userName = userName.Split('\\')[1];
}

string imagePath = $@"C:\Users\{userName}\Pictures";
if (Directory.Exists($@"C:\Users\{userName}\Pictures\fond_ecran"))
{
Expand Down

0 comments on commit 91d55f0

Please sign in to comment.