Skip to content

Commit

Permalink
Updated distributables + dist script
Browse files Browse the repository at this point in the history
- Updated distributables for v0.3.3
- Updated Joona Heikkilä alias
- Modified distributables script so that "EasyImgur Portable.bat" can be submitted to git in a single place outside of the EasyImgur build results folders
  • Loading branch information
bkeiren committed Aug 29, 2017
1 parent a1aec1f commit 10af4c0
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 36 deletions.
4 changes: 2 additions & 2 deletions EasyImgur/Contributors.cs
Expand Up @@ -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

Expand Down
Binary file modified dist/Debug/EasyImgur.exe
Binary file not shown.
Binary file modified dist/Release/EasyImgur.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions utility/content/EasyImgur Portable.bat
@@ -0,0 +1,2 @@
start EasyImgur.exe /portable
exit 0
1 change: 1 addition & 0 deletions utility/content/README.md
@@ -0,0 +1 @@
This folder contains files that are used by the scripts in the parent folder (./utility)
86 changes: 52 additions & 34 deletions 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")
Expand All @@ -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 ..."
Expand Down

0 comments on commit 10af4c0

Please sign in to comment.