diff --git a/EasyImgur/Contributors.cs b/EasyImgur/Contributors.cs index eb8e0c7..74aaa26 100644 --- a/EasyImgur/Contributors.cs +++ b/EasyImgur/Contributors.cs @@ -39,8 +39,8 @@ static Contributors() new Contributor { Name = "Joona Heikkilä", - Alias = "cubrr", - Url = "https://github.com/cubrr" + Alias = "cxcorp", + Url = "https://github.com/cxcorp" }, // Add new contributor here diff --git a/dist/Debug/EasyImgur.exe b/dist/Debug/EasyImgur.exe index 764a6b8..e61cfa9 100644 Binary files a/dist/Debug/EasyImgur.exe and b/dist/Debug/EasyImgur.exe differ diff --git a/dist/Release/EasyImgur.exe b/dist/Release/EasyImgur.exe index 8a60200..6afcbbb 100644 Binary files a/dist/Release/EasyImgur.exe and b/dist/Release/EasyImgur.exe differ diff --git a/utility/content/EasyImgur Portable.bat b/utility/content/EasyImgur Portable.bat new file mode 100644 index 0000000..4fa87f4 --- /dev/null +++ b/utility/content/EasyImgur Portable.bat @@ -0,0 +1,2 @@ +start EasyImgur.exe /portable +exit 0 \ No newline at end of file diff --git a/utility/content/README.md b/utility/content/README.md new file mode 100644 index 0000000..1b761bc --- /dev/null +++ b/utility/content/README.md @@ -0,0 +1 @@ +This folder contains files that are used by the scripts in the parent folder (./utility) \ No newline at end of file diff --git a/utility/copy_dists_psscript.ps1 b/utility/copy_dists_psscript.ps1 index 564c87d..4afc3a3 100644 --- a/utility/copy_dists_psscript.ps1 +++ b/utility/copy_dists_psscript.ps1 @@ -1,6 +1,7 @@ $easyimgur_folder = (Get-Item (Split-Path $script:MyInvocation.MyCommand.Path)).parent.FullName $destination_folder = $easyimgur_folder + "\dist\" -$source_folder = $easyimgur_folder + "\EasyImgur\bin\" +$bin_folder = $easyimgur_folder + "\EasyImgur\bin\" +$utility_content_source_folder = $easyimgur_folder + "\utility\content\" $incremented_version = "n" while ($incremented_version -ne "yes") @@ -11,43 +12,60 @@ while ($incremented_version -ne "yes") } -$files = "Release\EasyImgur.exe","Debug\EasyImgur.exe","Release\EasyImgur Portable.bat","Debug\EasyImgur Portable.bat" +# Each configuration will have its target files copied to a config-specific output folder +$configs = @{"Release" = @(($bin_folder + "Release\EasyImgur.exe"), ($utility_content_source_folder + "EasyImgur Portable.bat")); + "Debug" = @(($bin_folder + "Debug\EasyImgur.exe"), ($utility_content_source_folder + "EasyImgur Portable.bat"))} -ForEach ($file in $files) +ForEach ($config in $configs.GetEnumerator()) { - $full_destination_path = $destination_folder + $file - $full_source_path = $source_folder + $file - - $destination_timestamp = Get-Date -Date "1970-01-01 00:00:00Z" - $source_timestamp = Get-Date -Date "1970-01-01 00:00:00Z" - - if (Test-Path $full_destination_path) - { - $destination_timestamp = [datetime](Get-ItemProperty -Path $full_destination_path -Name LastWriteTime).lastwritetime - } - if (Test-Path $full_source_path) - { - $source_timestamp = [datetime](Get-ItemProperty -Path $full_source_path -Name LastWriteTime).lastwritetime - } - else - { - Write-Error ("Source file does not exist: " + $file) - continue - } + Write-Host "=======================" + Write-Host ("Config '" + $config.Name + "':") + + ForEach ($file in $config.Value) + { + Write-Host "-----------------------" + Write-Host (" File: " + $file) + + $filename = [System.IO.Path]::GetFileName($file) + + $full_destination_path = $destination_folder + $config.Name + "\" + $filename + $full_source_path = $file - if ($source_timestamp -gt $destination_timestamp) - { - Write-Host ("Detected newer source, copied file: " + $file) - Copy-Item $full_source_path $full_destination_path - } - else - { - Write-Warning ( "Source is not newer than destination, file not copied (did you forget to recompile?): `n`t" + - $file + - "`n`tSource: [" + $source_timestamp + "]`tDestination: [" + $destination_timestamp + "]") - } + $destination_timestamp = Get-Date -Date "1970-01-01 00:00:00Z" + $source_timestamp = Get-Date -Date "1970-01-01 00:00:00Z" + + if (Test-Path $full_destination_path) + { + $destination_timestamp = [datetime](Get-ItemProperty -Path $full_destination_path -Name LastWriteTime).lastwritetime + } + if (Test-Path $full_source_path) + { + $source_timestamp = [datetime](Get-ItemProperty -Path $full_source_path -Name LastWriteTime).lastwritetime + } + else + { + Write-Error ("Source file does not exist: " + $file) + continue + } - Write-Host "=======================" + if ($source_timestamp -gt $destination_timestamp) + { + Write-Host ("Detected newer source, copied file: " + $file) + + # "Touch" the destination file, which will create a new empty file and associated folder structure if it doesn't exist yet. If we omit this and the folders don't exist, then + # Copy-Item will raise an exception. Also note that New-Item by default has output, but we don't want to see that so we pipe it to Out-Null + New-Item -ItemType File -Path $full_destination_path -Force | Out-Null + Copy-Item $full_source_path $full_destination_path + } + else + { + Write-Warning ( "Source is not newer than destination, file not copied (did you forget to recompile?): `n`t" + + $file + + "`n`tSource: [" + $source_timestamp + "]`tDestination: [" + $destination_timestamp + "]") + } + } + + Write-Host "=======================" } Write-Host "Press any key to continue ..."