OS independent file paths
This commit is contained in:
@ -387,14 +387,14 @@ namespace Oqtane.Infrastructure
|
||||
}
|
||||
|
||||
// add folder for user
|
||||
var folder = folderRepository.GetFolder(user.SiteId, "Users\\");
|
||||
var folder = folderRepository.GetFolder(user.SiteId, "Users");
|
||||
if (folder != null)
|
||||
folderRepository.AddFolder(new Folder
|
||||
{
|
||||
SiteId = folder.SiteId,
|
||||
ParentId = folder.FolderId,
|
||||
Name = "My Folder",
|
||||
Path = folder.Path + newUser.UserId + "\\",
|
||||
Path = Path.Combine(folder.Path, newUser.UserId.ToString()),
|
||||
Order = 1,
|
||||
IsSystem = true,
|
||||
Permissions = new List<Permission>
|
||||
|
@ -103,7 +103,7 @@ namespace Oqtane.Infrastructure
|
||||
case ".svg":
|
||||
case ".js":
|
||||
case ".css":
|
||||
filename = sourceFolder + "\\" + entry.FullName.Replace("wwwroot", name).Replace("/", "\\");
|
||||
filename = Path.Combine(sourceFolder, entry.FullName.Replace("wwwroot", name));
|
||||
if (!Directory.Exists(Path.GetDirectoryName(filename)))
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(filename));
|
||||
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using Oqtane.Repository;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Oqtane.Shared;
|
||||
using System.IO;
|
||||
|
||||
namespace Oqtane.SiteTemplates
|
||||
{
|
||||
@ -131,16 +132,16 @@ namespace Oqtane.SiteTemplates
|
||||
}
|
||||
});
|
||||
|
||||
if (System.IO.File.Exists(_environment.WebRootPath + "\\images\\logo.png"))
|
||||
if (System.IO.File.Exists(Path.Combine(_environment.WebRootPath, "images", "logo.png")))
|
||||
{
|
||||
string folderpath = _environment.ContentRootPath + "\\Content\\Tenants\\" + site.TenantId.ToString() + "\\Sites\\" + site.SiteId.ToString() + "\\";
|
||||
string folderpath = Path.Combine(_environment.ContentRootPath, "Content", "Tenants", site.TenantId.ToString(), "Sites", site.SiteId.ToString());
|
||||
System.IO.Directory.CreateDirectory(folderpath);
|
||||
if (!System.IO.File.Exists(folderpath + "logo.png"))
|
||||
if (!System.IO.File.Exists(Path.Combine(folderpath, "logo.png")))
|
||||
{
|
||||
System.IO.File.Copy(_environment.WebRootPath + "\\images\\logo.png", folderpath + "logo.png");
|
||||
System.IO.File.Copy(Path.Combine(_environment.WebRootPath, "images", "logo.png"), Path.Combine(folderpath, "logo.png"));
|
||||
}
|
||||
Folder folder = _folderRepository.GetFolder(site.SiteId, "");
|
||||
File file = _fileRepository.AddFile(new File { FolderId = folder.FolderId, Name = "logo.png", Extension = "png", Size = 8192, ImageHeight = 80, ImageWidth = 250 });
|
||||
Oqtane.Models.File file = _fileRepository.AddFile(new Oqtane.Models.File { FolderId = folder.FolderId, Name = "logo.png", Extension = "png", Size = 8192, ImageHeight = 80, ImageWidth = 250 });
|
||||
site.LogoFileId = file.FileId;
|
||||
_siteRepository.UpdateSite(site);
|
||||
}
|
||||
|
Reference in New Issue
Block a user