Skip to content

Commit

Permalink
Merge pull request #24 from David032/22-fix-file-pathingautorun-issues
Browse files Browse the repository at this point in the history
22 Fix file pathing/autorun issues
  • Loading branch information
David032 authored Jan 15, 2024
2 parents 8a7fe25 + 4e180be commit 81558b6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 12 additions & 4 deletions skullOS.Core/FileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@ public static class FileManager
{
private static string rootDirectoryPath = string.Empty;

public static void CreateSkullDirectory()
public static void CreateSkullDirectory(bool usePersonalDir = true)
{
DirectoryInfo rootDirectory = null;

Check warning on line 11 in skullOS.Core/FileManager.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Converting null literal or possible null value to non-nullable type.

Check warning on line 11 in skullOS.Core/FileManager.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Converting null literal or possible null value to non-nullable type.
string pathToPersonalDir = @Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string pathToDir;
if (usePersonalDir)
{
pathToDir = @Environment.GetFolderPath(Environment.SpecialFolder.Personal);
}
else
{
pathToDir = "/media";
}
try
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
rootDirectory = Directory.CreateDirectory(@pathToPersonalDir + @"/skullOS",
unixCreateMode: UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
rootDirectory = Directory.CreateDirectory(pathToDir + @"/skullOS",
unixCreateMode: UnixFileMode.OtherRead | UnixFileMode.OtherWrite | UnixFileMode.OtherExecute);
}
}
catch (Exception e)
Expand Down
6 changes: 4 additions & 2 deletions skullOS.HardwareServices/CameraService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public async Task<string> TakePictureAsync(string fileLocation)
.WithTimeout(1)
.WithVflip()
.WithHflip()
.WithPictureOptions(quality: 100)
.WithResolution(2592, 1944);
var args = builder.GetArguments();

Expand All @@ -39,8 +40,9 @@ public async Task<string> TakePictureAsync(string fileLocation)
Console.WriteLine(proc.GetFullCommandLine(args));
Console.WriteLine();

//string? filename = $"{fileLocation} {DateTime.Now:yyyyMMddHHmmss}.jpg";
string? filename = $"{DateTime.Now:yyyyMMddHHmmss}.jpg"; //Fakename
var timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
string? filename = fileLocation + timestamp + ".jpg";
//string? filename = $"{DateTime.Now:yyyyMMddHHmmss}.jpg"; //Fakename
try
{
using var file = File.OpenWrite(filename);
Expand Down
2 changes: 1 addition & 1 deletion skullOS/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static void Run(bool shouldCreateDirectory = true)
{
if (shouldCreateDirectory)
{
FileManager.CreateSkullDirectory();
FileManager.CreateSkullDirectory(false);
}

SkullLogger logger = new();
Expand Down

0 comments on commit 81558b6

Please sign in to comment.