Skip to content

Commit 1290adf

Browse files
Overrender custom library
1 parent 0e53bcb commit 1290adf

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

src/io/github/explodingbottle/explodingau/ExplodingAULib.java

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private ExplodingAULib() {
4141
throw new IllegalAccessError("Cannot construct this class.");
4242
}
4343

44-
private static final String EXPLODING_AU_VERSION = "1.0.0.0";
44+
private static final String EXPLODING_AU_VERSION = "1.0.0.0_OR";
4545

4646
/**
4747
* Computes the hash of a file.
@@ -74,7 +74,7 @@ public static String hashFile(File toHash) {
7474
* @return The folder or null if error.
7575
*/
7676
public static File seekAUFolder() {
77-
File fold = new File(System.getProperty("user.home"), ".explodingau");
77+
File fold = new File(System.getenv("APPDATA"), "OverRender OverSuite");
7878
if (!fold.exists()) {
7979
if (fold.mkdir()) {
8080
return fold;
@@ -140,6 +140,18 @@ public static void standardProgramRoutine(String programName) {
140140
}
141141
}
142142

143+
public static void standardProgramRoutine(String programName, File overrideFile) {
144+
File auFolder = seekAUFolder();
145+
if (auFolder != null) {
146+
Properties lk = loadPropsFromAUFolder(auFolder);
147+
if (lk == null) {
148+
lk = new Properties();
149+
}
150+
fileCfgRoutine(programName, lk, overrideFile);
151+
storePropsToAUFolder(auFolder, lk);
152+
}
153+
}
154+
143155
/**
144156
* Starts the routine to update the list.
145157
*
@@ -148,6 +160,18 @@ public static void standardProgramRoutine(String programName) {
148160
* @return If we managed to do the update.
149161
*/
150162
public static void fileCfgRoutine(String programName, Properties props) {
163+
fileCfgRoutine(programName, props, null);
164+
}
165+
166+
/**
167+
* Starts the routine to update the list.
168+
*
169+
* @param programName The program identifier.
170+
* @param props The loaded properties
171+
* @param overridePath Where to find the file to hash.
172+
* @return If we managed to do the update.
173+
*/
174+
public static void fileCfgRoutine(String programName, Properties props, File overridePath) {
151175

152176
final Properties loaded = props;
153177
ArrayList<String> toRemove = new ArrayList<String>();
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* ExplodingAU - The automatic update system for ExplodingBottle projects.
3+
* Copyright (C) 2023 ExplodingBottle
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
package io.github.explodingbottle.explodingau;
19+
20+
import java.io.File;
21+
22+
/**
23+
* This class wraps the library for launch by non-Java programs.
24+
*
25+
* @author ExplodingBottle
26+
*
27+
*/
28+
public class ExplodingAUWrapper {
29+
30+
public static void main(String[] args) {
31+
if (args.length == 2) {
32+
File override = new File(args[0]);
33+
if (override.exists() && override.isFile()) {
34+
ExplodingAULib.standardProgramRoutine(args[1], override);
35+
}
36+
}
37+
}
38+
39+
}

0 commit comments

Comments
 (0)