From 760607995a07413df73f3a14cf72c92aa526065d Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Mon, 16 Oct 2017 16:30:55 +0200
Subject: [PATCH] Update README and post build log message

---
 README.md               | 21 +++++++++++++++++----
 Resources/PostBuild.ps1 |  3 ++-
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 6ca0fa28..17badfc7 100644
--- a/README.md
+++ b/README.md
@@ -33,21 +33,34 @@ To do that, open **TweetDuck Properties**, click the **Debug** tab, make sure yo
 
 ### Build
 
-To make a release build of TweetDuck, open **Batch Build**, tick all `Release` configurations except for the `UnitTest` project (otherwise the build will fail), and click **Rebuild**. Check the status bar to make sure it says **Rebuild All succeeded**; if not, open the **Output** view and see which part of the build failed.
+To make a release build of TweetDuck, open **Batch Build**, tick all `Release` configurations except for the `UnitTest` project (otherwise the build will fail), and click **Rebuild**. Check the status bar to make sure it says **Rebuild All succeeded**; if not, see the [Troubleshooting](#Troubleshooting) section.
 
-After the build succeeds, the **bin/x86/Release** folder will contain files intended for distribution (no debug symbols or other unnecessary files). You may package these files yourself, or see the [Installers](#Installers) section for automated installer generation.
+After the build succeeds, the `bin/x86/Release` folder will contain files intended for distribution (no debug symbols or other unnecessary files). You may package these files yourself, or see the [Installers](#Installers) section for automated installer generation.
 
 If you decide to release a custom version publicly, please make it clear that it is not an official release of TweetDuck.
 
+### Troubleshooting
+
+There are a few quirks in the build process that may catch you off guard:
+
+- **Plugin files are not updated automatically**
+  - Since official plugins (`Resources/Plugins`) are not included in the project, Visual Studio will not automatically detect changes in the files
+  - To ensure plugins are updated when testing the app, click **Rebuild Solution** before clicking **Start**
+- **Error: The command (...) exited with code 1**
+  - If the post-build event fails, open the **Output** tab and look for the cause
+  - Determine if there was an IO error while copying files or modifying folders, or whether the final .ps1 script failed (`Encountered an error while running PostBuild.ps1 on line xyz`)
+  - Some files are checked for invalid characters:
+    - `Resources/Plugins/emoji-keyboard/emoji-ordering.txt` line endings must be LF (line feed); any CR (carriage return) in the file will cause a failed build, and you will need to ensure correct line endings in your text editor
+
 ### Installers
 
 TweetDuck uses **Inno Setup** to automate the creation of installers. First, download and install [InnoSetup QuickStart Pack](http://www.jrsoftware.org/isdl.php) (non-unicode; editor and encryption support not required) and the [Inno Download Plugin](https://code.google.com/archive/p/inno-download-plugin).
 
 Next, add the Inno Setup installation folder (usually `C:\Program Files (x86)\Inno Setup 5`) into your **PATH** environment variable. You may need to restart File Explorer for the change to take place.
 
-Now you can generate installers after a build by running **bld/RUN BUILD.bat**. Note that despite the name, this will only package the files, you still need to run the [build](#Build) in Visual Studio!
+Now you can generate installers after a build by running `bld/RUN BUILD.bat`. Note that despite the name, this will only package the files, you still need to run the [build](#Build) in Visual Studio!
 
-After the window closes, three installers will be generated inside the **bld/Output** folder:
+After the window closes, three installers will be generated inside the `bld/Output` folder:
 * **TweetDuck.exe**
   * This is the main installer that creates entries in the Start Menu & Programs and Features, and an optional desktop icon
 * **TweetDuck.Update.exe**
diff --git a/Resources/PostBuild.ps1 b/Resources/PostBuild.ps1
index 8ff64012..4714ffd3 100644
--- a/Resources/PostBuild.ps1
+++ b/Resources/PostBuild.ps1
@@ -7,11 +7,12 @@ function Check-Carriage-Return{
   Param([Parameter(Mandatory = $True, Position = 1)] $fname)
   
   $file = @(Get-ChildItem -Include $fname -Recurse)[0]
-  Write-Host "Checking" $file.FullName.Substring($dir.Length)
   
   if ((Get-Content -Path $file.FullName -Raw).Contains("`r")){
     Throw "$fname cannot contain carriage return"
   }
+  
+  Write-Host "Verified" $file.FullName.Substring($dir.Length)
 }
 
 function Rewrite-File{