-
Notifications
You must be signed in to change notification settings - Fork 802
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BREAKING CHANGE] IFileSystem has a new GetLastWriteTimeUtc property.…
… This is done to remove the extra IGeneratorFileSystem interface and the same property from ITemporaryFileSystem. If you have custom implementation for IFileSystem, you should also implement GetLastWriteTimeUtc method. Usings MSBuild's new command line build property extraction feature in Sergen for .NET8+
- Loading branch information
1 parent
ed92ffd
commit 2a1e083
Showing
49 changed files
with
589 additions
and
491 deletions.
There are no files selected for viewing
6 changes: 0 additions & 6 deletions
6
src/Serenity.Net.CodeGenerator/CodeGeneration/Base/IGeneratorFileSystem.cs
This file was deleted.
Oops, something went wrong.
46 changes: 2 additions & 44 deletions
46
src/Serenity.Net.CodeGenerator/CodeGeneration/Base/PhysicalGeneratorFileSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,11 @@ | ||
namespace Serenity.CodeGeneration; | ||
namespace Serenity.CodeGeneration; | ||
|
||
public class PhysicalGeneratorFileSystem : PhysicalFileSystem, IGeneratorFileSystem | ||
public class PhysicalGeneratorFileSystem : PhysicalFileSystem | ||
{ | ||
public DateTime GetLastWriteTime(string path) | ||
{ | ||
return System.IO.File.GetLastWriteTime(path); | ||
} | ||
|
||
#if ISSOURCEGENERATOR | ||
// https://stackoverflow.com/questions/275689/how-to-get-relative-path-from-absolute-path/32113484#32113484 | ||
public override string GetRelativePath(string fromPath, string toPath) | ||
{ | ||
if (string.IsNullOrEmpty(fromPath)) | ||
throw new ArgumentNullException("fromPath"); | ||
|
||
if (string.IsNullOrEmpty(toPath)) | ||
throw new ArgumentNullException("toPath"); | ||
|
||
fromPath = fromPath.Replace("/", "\\", StringComparison.Ordinal); | ||
toPath = toPath.Replace("/", "\\", StringComparison.Ordinal); | ||
|
||
if (!fromPath.Contains(':', StringComparison.Ordinal)) | ||
fromPath = "z:\\" + fromPath; | ||
|
||
if (!toPath.Contains(':', StringComparison.Ordinal)) | ||
toPath = "z:\\" + toPath; | ||
|
||
Uri fromUri = new(AppendDirectorySeparatorChar(fromPath)); | ||
Uri toUri = new(AppendDirectorySeparatorChar(toPath)); | ||
|
||
if (fromUri.Scheme != toUri.Scheme) | ||
return toPath; | ||
|
||
Uri relativeUri = fromUri.MakeRelativeUri(toUri); | ||
string relativePath = Uri.UnescapeDataString(relativeUri.ToString()); | ||
|
||
if (string.Equals(toUri.Scheme, Uri.UriSchemeFile, StringComparison.OrdinalIgnoreCase)) | ||
relativePath = relativePath.Replace(System.IO.Path.AltDirectorySeparatorChar, System.IO.Path.DirectorySeparatorChar); | ||
|
||
return relativePath; | ||
} | ||
|
||
private static string AppendDirectorySeparatorChar(string path) | ||
{ | ||
if (!System.IO.Path.HasExtension(path) && | ||
!path.EndsWith(System.IO.Path.DirectorySeparatorChar.ToString())) | ||
return path + System.IO.Path.DirectorySeparatorChar; | ||
|
||
return path; | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.