Skip to content
This repository was archived by the owner on Nov 6, 2018. It is now read-only.

Set modified date in EmbeddedFileProvider #210

Merged
merged 1 commit into from
Jul 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,24 @@ public EmbeddedFileProvider(Assembly assembly, string baseNamespace)

_baseNamespace = string.IsNullOrEmpty(baseNamespace) ? string.Empty : baseNamespace + ".";
_assembly = assembly;
// REVIEW: Does this even make sense?
_lastModified = DateTimeOffset.MaxValue;

_lastModified = DateTimeOffset.UtcNow;

#if NETSTANDARD1_5 || NET451
if (!string.IsNullOrEmpty(_assembly.Location))
{
try
{
_lastModified = File.GetLastWriteTimeUtc(_assembly.Location);
}
catch (PathTooLongException)
{
}
catch (UnauthorizedAccessException)
{
}
}
#endif
}

/// <summary>
Expand Down
13 changes: 9 additions & 4 deletions src/Microsoft.Extensions.FileProviders.Embedded/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@
"version": "1.1.0-*",
"type": "build"
},
"Microsoft.Extensions.FileProviders.Abstractions": "1.1.0-*"
"Microsoft.Extensions.FileProviders.Abstractions": "1.1.0-*",
"System.Runtime.Extensions": "4.1.0-*"
},
"frameworks": {
"netstandard1.0": {
// need to keep netstandard1.0 until ASP.NET Core 2.0 because it is a breaking change if we remove it
"netstandard1.0": { },
"netstandard1.5": {
Copy link
Member

Choose a reason for hiding this comment

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

We can add comments again, right? This might be worth a comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also we possibly want to cross compile to net451 to get this functionality on full framework.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a good point, will add

"dependencies": {
"System.Runtime.Extensions": "4.1.0-*"
"System.IO.FileSystem": "4.0.1-*",
"System.Reflection": "4.1.0-*"
}
}
},
"net451": { }
}
}