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

Expose System.IO properties directly in SystemFile #27

Closed
HEIC-to-JPEG-Dev opened this issue Mar 26, 2023 · 1 comment
Closed

Expose System.IO properties directly in SystemFile #27

HEIC-to-JPEG-Dev opened this issue Mar 26, 2023 · 1 comment

Comments

@HEIC-to-JPEG-Dev
Copy link

HEIC-to-JPEG-Dev commented Mar 26, 2023

Issue
SystemFile assumes it's existance, and has limited use (issue #26) and without core properties (Attributes, Dates, Exists, etc) is slow and unusable.

Reason
A file's state is not static, it can change outside of the app at any time.

Proposal
The constructor of SystemFile should not assume or enforce anything. It shoudl simply return an object (or null).
The developer can then check for Exists, Attributes, and use the path manipulation properties even on none-existance files.

For example: systemFile.Filename or systemFile.Extention - these properties are very useful for path manipulation and are currently absent and also would not be available if the constructor of systemFile rejects none-existant files.

@Arlodotexe Arlodotexe changed the title SystemFile Core Properties Expose System.IO properties directly in SystemFile Mar 31, 2023
@Arlodotexe
Copy link
Owner

Arlodotexe commented Mar 31, 2023

Thanks for the feedback! Happy to clarify some things.


SystemFile assumes it's existance...The constructor of SystemFile should not assume or enforce anything. It shoudl simply return an object (or null).

This is intentional, see this comment.


For example: systemFile.Filename or systemFile.Extention

We expose the file name using by implementing this interface.

Use System.IO.Path.GetExtension to get the extension from the name.


The developer can then check for Exists, Attributes, and use the path manipulation properties even on none-existance files.

In #23, we're working on standardizing properties so properties from implementation can be consumed using a single common API.

It seems like you just need access to the underlying System.IO APIs given an instance of SystemFile or SystemFolder.

We try to provide this functionality in every implementation we make, so there's no need to add all these things to SystemFile directly. I recommend using the SystemFile.Path with System.IO APIs such as FileInfo.

For example,

var file = new SystemFile("C:\file.txt");
var fileInfo = new FileInfo(file.Path);

// Access the data you need
var w = fileInfo.Attributes;
var x = fileInfo.CreationTime;
var y = fileInfo.Exists;
var z = fileInfo.Length;

@Arlodotexe Arlodotexe closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2023
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

No branches or pull requests

2 participants