Skip to content

Commit

Permalink
Using File.pathSeparator instead of adding it to API...
Browse files Browse the repository at this point in the history
Not sure what's wrong with me ;)
  • Loading branch information
tomsik68 committed Aug 28, 2014
1 parent e2eb8ad commit 7fab19a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 35 deletions.
6 changes: 0 additions & 6 deletions src/sk/tomsik68/mclauncher/api/common/IOperatingSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,4 @@ public interface IOperatingSystem {
*/
public String getArchitecture();

/**
*
* @return System-specific char or string which will be used to separate
* multiple paths
*/
public String getLibrarySeparator();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package sk.tomsik68.mclauncher.api.servers;

public class ServerPingPacketFactory {
public ServerPingPacketFactory() {

}

public byte[] create() {
return null;
}
}
4 changes: 0 additions & 4 deletions src/sk/tomsik68/mclauncher/impl/common/LinuxOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ public String getArchitecture() {
return System.getProperty("sun.arch.data.model");
}

@Override
public String getLibrarySeparator() {
return ":";
}
}
4 changes: 0 additions & 4 deletions src/sk/tomsik68/mclauncher/impl/common/MacintoshOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,5 @@ public File getWorkingDirectory() {
public String getArchitecture() {
return System.getProperty("sun.arch.data.model");
}
@Override
public String getLibrarySeparator() {
return ":";
}

}
4 changes: 0 additions & 4 deletions src/sk/tomsik68/mclauncher/impl/common/SolarisOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,4 @@ public String getArchitecture() {
return System.getProperty("sun.arch.data.model");
}

@Override
public String getLibrarySeparator() {
return ":";
}
}
4 changes: 0 additions & 4 deletions src/sk/tomsik68/mclauncher/impl/common/UnknownOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,5 @@ public File getWorkingDirectory() {
public String getArchitecture() {
return System.getProperty("sun.arch.data.model");
}
@Override
public String getLibrarySeparator() {
return ";";
}

}
4 changes: 0 additions & 4 deletions src/sk/tomsik68/mclauncher/impl/common/WindowsOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,4 @@ public File getWorkingDirectory() {
public String getArchitecture() {
return System.getProperty("sun.arch.data.model");
}
@Override
public String getLibrarySeparator() {
return ";";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,17 @@ public void install(IVersion v, IMinecraftInstance mc, IProgressMonitor progress
updateResources(mc, version, progress);
File jarDest = mc.getJarProvider().getVersionFile(version.getUniqueID());
File jsonDest = new File(jarDest.getParentFile(), "info.json");
if (!jsonDest.exists())
FileUtils.writeFile(jsonDest, version.toJSON().toJSONString(JSONStyle.LT_COMPRESS));
if (!jarDest.exists()) {
// always overwrite json file
// if (!jsonDest.exists())
FileUtils.writeFile(jsonDest, version.toJSON().toJSONString(JSONStyle.LT_COMPRESS));
// and jar file
// if (!jarDest.exists())
try {
FileUtils.downloadFileWithProgress(MCLauncherAPI.URLS.NEW_JAR_DOWNLOAD_URL.replace("<VERSION>", version.getId()), jarDest, progress);
} catch (Exception e) {
e.printStackTrace();
}
}

notifyListeners(version);
if (progress != null)
progress.finish();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public List<String> getLaunchCommand(ISession session, IMinecraftInstance mc, IS
command.add("-Djava.library.path=" + nativesDir.getAbsolutePath());
command.add("-cp");
StringBuilder sb = new StringBuilder();
final String LIBRARY_SEPARATOR = Platform.getCurrentPlatform().getLibrarySeparator();
final String LIBRARY_SEPARATOR = File.pathSeparator;
for (Library lib : version.getLibraries()) {
if (lib.isCompatible())
sb = sb.append(mc.getLibraryProvider().getLibraryFile(lib).getAbsolutePath()).append(LIBRARY_SEPARATOR);
Expand Down
8 changes: 4 additions & 4 deletions src/sk/tomsik68/mclauncher/util/FilePathBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
import java.io.File;

public class FilePathBuilder {
private File file;
private String path;

public FilePathBuilder(File start) {
this.file = start;
this.path = start.getAbsolutePath();
}

public FilePathBuilder append(String s) {
file = new File(file, s);
path += File.separator + s;
return this;
}
public File getResult(){
return file;
return new File(path);
}
}

0 comments on commit 7fab19a

Please sign in to comment.