mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 16:20:04 +00:00
Check OS before hiding internal folder
This commit is contained in:
@@ -10,18 +10,16 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.context.event.EventListener;
|
import org.springframework.context.event.EventListener;
|
||||||
import org.springframework.core.env.*;
|
import org.springframework.core.env.*;
|
||||||
import org.springframework.util.PropertyPlaceholderHelper;
|
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.LinkOption;
|
import java.nio.file.LinkOption;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
@@ -48,6 +46,8 @@ public class FilesystemConfig {
|
|||||||
*/
|
*/
|
||||||
@EventListener(ApplicationReadyEvent.class)
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
public void hideInternalFolderOnDOS() throws IOException {
|
public void hideInternalFolderOnDOS() throws IOException {
|
||||||
|
if (!isRunningOnWindows()) return;
|
||||||
|
|
||||||
Path internalFolder = Paths.get("%s/%s".formatted(firstLibraryPath, INTERNAL_FOLDER_NAME));
|
Path internalFolder = Paths.get("%s/%s".formatted(firstLibraryPath, INTERNAL_FOLDER_NAME));
|
||||||
|
|
||||||
if (!Files.exists(internalFolder) || !Files.isDirectory(internalFolder)) return;
|
if (!Files.exists(internalFolder) || !Files.isDirectory(internalFolder)) return;
|
||||||
@@ -72,6 +72,7 @@ public class FilesystemConfig {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This bean is needed so Spring initializes the data source after we are done messing with the configuration environment
|
* This bean is needed so Spring initializes the data source after we are done messing with the configuration environment
|
||||||
|
*
|
||||||
* @return DataSource
|
* @return DataSource
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "spring.datasource")
|
@ConfigurationProperties(prefix = "spring.datasource")
|
||||||
@@ -101,4 +102,8 @@ public class FilesystemConfig {
|
|||||||
return props;
|
return props;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isRunningOnWindows() {
|
||||||
|
return System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "1.2.2-SNAPSHOT",
|
"version": "1.2.3-SNAPSHOT",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "1.2.2-SNAPSHOT",
|
"version": "1.2.3-SNAPSHOT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^14.0.0",
|
"@angular/animations": "^14.0.0",
|
||||||
"@angular/cdk": "^14.1.0",
|
"@angular/cdk": "^14.1.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "frontend",
|
"name": "frontend",
|
||||||
"version": "1.2.2-SNAPSHOT",
|
"version": "1.2.3-SNAPSHOT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
|
|||||||
Reference in New Issue
Block a user