Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSOE-98: Save per-page screenshots to files directly to conserve memory #152

Merged
merged 12 commits into from
Apr 8, 2022

Conversation

Piedone
Copy link
Member

@Piedone Piedone commented Apr 7, 2022

Comment on lines 8 to 10
public const string DefaultSetupSnapshotDirectoryPath = "SetupSnapshot";
public const string TempDirectoryPath = "Temp";
public const string ScreenshotsDirectoryName = "Screenshots";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two are called *DirectoryPath one is called *DirectoryName. If this is a meaningful distinction, please comment.

By the way if you renamed the class to DirectoryPaths then you wouldn't need to prefix the variables and you could use nameof.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How they're used there can be a difference, but let's not have that.

public const string TempDirectoryPath = "Temp";
public const string ScreenshotsDirectoryName = "Screenshots";

public static string GetTempSubDirectoryPath(string contextId, string subDirectoryName) =>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you pass string.Empty to this below. Would it be nicer to make "" the default value of the subDirectoryName argument? Or better yet, make it params string[] subDirectoryNames?

public static string GetTempSubDirectoryPath(string contextId, string subDirectoryName) =>
Path.Combine(Environment.CurrentDirectory, Temp, contextId, subDirectoryName);
public static string GetTempSubDirectoryPath(string contextId, params string[] subDirectoryNames) =>
Path.Combine(new[] { Environment.CurrentDirectory, Temp, contextId }.Union(subDirectoryNames).ToArray());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.Union() is a set operator. Only use it if you want to treat your collection as a set. In this case use .Concat().
image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right.

@sarahelsaig sarahelsaig merged commit 123098d into dev Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants