Created
March 30, 2016 20:10
-
-
Save VincentDondain/92620172409be8d0d4af91390b3fb15f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit cd1c28a9c490158888d77d8c594c8481c6758e7f | |
Author: VincentDondain <vincent.dondain@xamarin.com> | |
Date: Wed Mar 30 21:07:16 2016 +0100 | |
[iOS] Re-upload app on re-run | |
diff --git a/MonoDevelop.IPhone/MonoDevelop.IPhone/Execution/IPhoneDeployOperation.cs b/MonoDevelop.IPhone/MonoDevelop.IPhone/Execution/IPhoneDeployOperation.cs | |
index dc045ad..5e0b4a0 100644 | |
--- a/MonoDevelop.IPhone/MonoDevelop.IPhone/Execution/IPhoneDeployOperation.cs | |
+++ b/MonoDevelop.IPhone/MonoDevelop.IPhone/Execution/IPhoneDeployOperation.cs | |
@@ -36,20 +36,26 @@ namespace MonoDevelop.IPhone | |
static void TouchUploadMarker (FilePath appDir, string deviceName) | |
{ | |
+ var timestamp = DateTime.UtcNow.Ticks; | |
+ | |
if (deviceName == null) { | |
deviceName = "default"; | |
} | |
var markerFile = GetUploadMarkerFile (appDir); | |
if (!File.Exists (markerFile)) { | |
- File.WriteAllText (markerFile, "# This file is used to determine when the app was last uploaded to a device\n" + deviceName); | |
+ File.WriteAllText (markerFile, string.Format ("# This file is used to determine when the app was last uploaded to a device\n$ {0}\n{1}", timestamp, deviceName)); | |
return; | |
} | |
// Check if the device is already listed (we don't want to add it more than once) | |
- var devices = File.ReadAllLines (markerFile); | |
- for (int i = 1; i < devices.Length; i++) { | |
- if (devices[i] == deviceName) | |
+ var lines = File.ReadAllLines (markerFile); | |
+ | |
+ lines [1] = string.Format ("$ {0}", timestamp); | |
+ File.WriteAllLines (markerFile, lines); | |
+ | |
+ for (int i = 2; i < lines.Length; i++) { | |
+ if (lines[i] == deviceName) | |
return; | |
} | |
@@ -69,6 +75,15 @@ namespace MonoDevelop.IPhone | |
if (!line.StartsWith ("# ", StringComparison.Ordinal) && line == deviceName) { | |
return true; | |
} | |
+ | |
+ if (line.StartsWith ("$", StringComparison.Ordinal)) { | |
+ long lastUploadTime; | |
+ var timestamp = line.Substring (1); | |
+ if (long.TryParse (timestamp, out lastUploadTime)) { | |
+ // Return false when the app directory is more recent that the last upload... | |
+ return Directory.GetLastWriteTimeUtc (appDir).Ticks < lastUploadTime; | |
+ } | |
+ } | |
} | |
} | |
return false; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment