feat: add fnOS packaging, storage workflows and release pipeline

This commit is contained in:
2026-08-11 18:05:49 +08:00
parent c5922f9b08
commit 95932f0199
181 changed files with 24024 additions and 1164 deletions
+35
View File
@@ -0,0 +1,35 @@
namespace dy.net.storage
{
public static class StoragePath
{
public static string NormalizeRemote(string path)
{
if (string.IsNullOrWhiteSpace(path)) return "/";
var normalized = path.Replace('\\', '/').Trim();
var segments = normalized.Split('/', StringSplitOptions.RemoveEmptyEntries);
if (segments.Any(x => x == "." || x == ".."))
throw new ArgumentException("远端存储路径不能包含 . 或 ..", nameof(path));
return "/" + string.Join('/', segments);
}
public static string CombineRemote(params string[] parts)
{
return NormalizeRemote(string.Join('/', parts.Where(x => !string.IsNullOrWhiteSpace(x))));
}
public static string DirectoryName(string path)
{
var normalized = NormalizeRemote(path);
var lastSlash = normalized.LastIndexOf('/');
return lastSlash <= 0 ? "/" : normalized[..lastSlash];
}
public static string Encode(string path)
{
var normalized = NormalizeRemote(path);
return string.Join('/', normalized.Split('/').Select(Uri.EscapeDataString));
}
}
}