Skip to content

Commit

Permalink
Updated Web Resources Tool to save files
Browse files Browse the repository at this point in the history
  • Loading branch information
crisfervil committed Nov 29, 2017
1 parent bb1212a commit 44762e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Initiates the command in watch mode



### -n, --name-filters
Only the web resources beggining with thesee filters are going to be included



### -c, --connection
Required. Connection string, or name of a connection string to use

Expand Down
9 changes: 8 additions & 1 deletion src/XrmCommandBox/Tools/WebResourcesSyncTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,15 @@ private void Save(EntityCollection webResources, string basePath)
var webResourceName = (string)webResource["name"];
var binaryContent = Convert.FromBase64String(content);
var filePath = Path.Combine(basePath, webResourceName);
var folderPath = Path.GetDirectoryName(filePath);
_log.Info($"Saving {filePath}...");
}--
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath); // make sure the folder structure exists
}

File.WriteAllBytes(filePath, binaryContent);
}
}

private EntityCollection GetWebResources(IEnumerable<string> namePrefixes)
Expand Down

0 comments on commit 44762e1

Please sign in to comment.