in Tools/Common/PowerApps.Tools.Utilities/Helper.cs [62:99]
public void CopyAppResources(string msAppPath, string sourcePath, string destinationPath)
{
if (string.IsNullOrWhiteSpace(sourcePath) ||
string.IsNullOrWhiteSpace(destinationPath))
throw new ArgumentNullException("App path is null or empty.");
CreateDirectoryIfNotExist(destinationPath);
var assetPath = Path.Combine(sourcePath, AppFileName.AssetsDirectoryName);
if (Directory.Exists(assetPath))
{
var assetFilesPath = new List<string>();
var directoryList = Directory.GetDirectories(assetPath)?.ToList() ?? new List<string>();
directoryList.Add(assetPath);
directoryList?.ForEach(r =>
{
// CreateDirectoryIfNotExist(r.Replace(sourcePath, destinationPath));
var filePath = Directory.GetFiles(r)?.ToList();
if (filePath != null && filePath.Count > 0)
assetFilesPath.AddRange(filePath);
});
foreach (string file in assetFilesPath)
{
using (FileStream zipToOpen = new FileStream(msAppPath, FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(zipToOpen, ZipArchiveMode.Update))
{
string entryName = file.Substring(file.IndexOf(AppFileName.AssetsDirectoryName));
ZipFileExtensions.CreateEntryFromFile(archive, file, entryName);
}
}
}
}
}