diff options
author | Marcin Floryan <marcin.floryan@gmail.com> | 2012-11-03 15:02:01 +0000 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2012-11-03 15:15:22 -0400 |
commit | 856c8a2ad521064d69b2b50003c1df382d375013 (patch) | |
tree | 570fb452883c5818883679a533f994bd44131c84 /src/com/gitblit | |
parent | 1370d424a794ec191966b81f4f975161a38895dc (diff) | |
download | gitblit-856c8a2ad521064d69b2b50003c1df382d375013.tar.gz gitblit-856c8a2ad521064d69b2b50003c1df382d375013.zip |
Download progress - CR character behaves as expected on Windows but not on other platforms.
Diffstat (limited to 'src/com/gitblit')
-rw-r--r-- | src/com/gitblit/build/Build.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/gitblit/build/Build.java b/src/com/gitblit/build/Build.java index d5abc240..90cda130 100644 --- a/src/com/gitblit/build/Build.java +++ b/src/com/gitblit/build/Build.java @@ -48,6 +48,8 @@ import com.gitblit.utils.StringUtils; */
public class Build {
+ private static final String osName = System.getProperty("os.name");
+
public interface DownloadListener {
public void downloading(String name);
}
@@ -497,14 +499,17 @@ public class Build { }
private static void updateProgress(float progress, String url) {
- String anim = "==========";
+ boolean isWindows = osName.contains("Windows");
+ String anim = "==========";
int width = Math.round(anim.length() * progress);
- System.out.print("\r[");
+ if (isWindows) System.out.print("\r");
+ System.out.print("[");
System.out.print(anim.substring(0, Math.min(width, anim.length())));
for (int i = 0; i < anim.length() - width; i++) {
System.out.print(' ');
}
System.out.print("] " + url);
+ if (!isWindows) System.out.println();
}
/**
|