forked from MinecraftForge/Installer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for installing config files #INS-1 fixed
- Loading branch information
1 parent
7cad2f6
commit 1788382
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cpw.mods.fml.installer.mods; | ||
|
||
import java.io.File; | ||
import java.net.URL; | ||
|
||
import javax.swing.ProgressMonitor; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
|
||
import cpw.mods.fml.installer.DownloadFile; | ||
|
||
import argo.jdom.JsonNode; | ||
|
||
public class ConfigInfo { | ||
|
||
private String filename; | ||
private String directory; | ||
private URL url; | ||
|
||
public ConfigInfo(JsonNode json) throws Exception { | ||
this.filename = json.getStringValue("filename"); | ||
this.directory = json.getStringValue("directory"); | ||
this.url = new URL(json.getStringValue("url")); | ||
} | ||
|
||
public DownloadFile createDownload(File target, ProgressMonitor monitor) { | ||
File dest = FileUtils.getFile(target, directory.replace('/', File.separatorChar), filename); | ||
if (!dest.getParentFile().exists() && dest.getParentFile().isDirectory()) { | ||
dest.getParentFile().mkdirs(); | ||
} | ||
return new DownloadFile(url, dest); | ||
} | ||
} |
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