mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] sync updatescache command
This commit is contained in:
parent
11382d3465
commit
80176ff1e1
4 changed files with 31 additions and 2 deletions
|
@ -37,7 +37,6 @@ public void printHelp() {
|
||||||
logger.info("Print help for component:");
|
logger.info("Print help for component:");
|
||||||
logger.info("component unload [componentName]");
|
logger.info("component unload [componentName]");
|
||||||
logger.info("component load [componentName] [filename]");
|
logger.info("component load [componentName] [filename]");
|
||||||
logger.info("component gc [componentName]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,11 +11,12 @@ public SyncCommand(LaunchServer server) {
|
||||||
this.childCommands.put("updates", new SyncUpdatesCommand(server));
|
this.childCommands.put("updates", new SyncUpdatesCommand(server));
|
||||||
this.childCommands.put("up", new SyncUPCommand(server));
|
this.childCommands.put("up", new SyncUPCommand(server));
|
||||||
this.childCommands.put("launchermodules", new SyncLauncherModulesCommand(server));
|
this.childCommands.put("launchermodules", new SyncLauncherModulesCommand(server));
|
||||||
|
this.childCommands.put("updatescache", new SyncUpdatesCacheCommand(server));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getArgsDescription() {
|
public String getArgsDescription() {
|
||||||
return "[updates/profiles/up/binaries/launchermodules] [args...]";
|
return "[updates/profiles/up/binaries/launchermodules/updatescache] [args...]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package pro.gravit.launchserver.command.sync;
|
||||||
|
|
||||||
|
import pro.gravit.launchserver.LaunchServer;
|
||||||
|
import pro.gravit.launchserver.command.Command;
|
||||||
|
|
||||||
|
public class SyncUpdatesCacheCommand extends Command {
|
||||||
|
public SyncUpdatesCacheCommand(LaunchServer server) {
|
||||||
|
super(server);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getArgsDescription() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsageDescription() {
|
||||||
|
return "sync updates cache";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invoke(String... args) throws Exception {
|
||||||
|
server.updatesManager.readUpdatesFromCache();
|
||||||
|
}
|
||||||
|
}
|
|
@ -52,6 +52,10 @@ private void readCache(Path file) throws IOException {
|
||||||
this.updatesDirMap = Collections.unmodifiableMap(updatesDirMap);
|
this.updatesDirMap = Collections.unmodifiableMap(updatesDirMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void readUpdatesFromCache() throws IOException {
|
||||||
|
readCache(cacheFile);
|
||||||
|
}
|
||||||
|
|
||||||
public void readUpdatesDir() throws IOException {
|
public void readUpdatesDir() throws IOException {
|
||||||
if (server.config.cacheUpdates) {
|
if (server.config.cacheUpdates) {
|
||||||
if (Files.exists(cacheFile)) {
|
if (Files.exists(cacheFile)) {
|
||||||
|
|
Loading…
Reference in a new issue