@@ -9,7 +9,7 @@ import useMemorySlider from '@/composables/useMemorySlider'
99import { edit , get_optimal_jre_key } from ' @/helpers/profile'
1010import { get } from ' @/helpers/settings.ts'
1111
12- import type { AppSettings , InstanceSettingsTabProps , MemorySettings } from ' ../../../helpers/types'
12+ import type { AppSettings , InstanceSettingsTabProps } from ' ../../../helpers/types'
1313
1414const { handleError } = injectNotificationManager ()
1515const { formatMessage } = useVIntl ()
@@ -22,12 +22,12 @@ const overrideJavaInstall = ref(!!props.instance.java_path)
2222const optimalJava = readonly (await get_optimal_jre_key (props .instance .path ).catch (handleError ))
2323const javaInstall = ref ({ path: optimalJava .path ?? props .instance .java_path })
2424
25- const overrideJavaArgs = ref (props .instance .extra_launch_args ?.length !== undefined )
25+ const overrideJavaArgs = ref (( props .instance .extra_launch_args ?.length ?? 0 ) > 0 )
2626const javaArgs = ref (
2727 (props .instance .extra_launch_args ?? globalSettings .extra_launch_args ).join (' ' ),
2828)
2929
30- const overrideEnvVars = ref (props .instance .custom_env_vars ?.length !== undefined )
30+ const overrideEnvVars = ref (( props .instance .custom_env_vars ?.length ?? 0 ) > 0 )
3131const envVars = ref (
3232 (props .instance .custom_env_vars ?? globalSettings .custom_env_vars )
3333 .map ((x ) => x .join (' =' ))
@@ -42,36 +42,23 @@ const { maxMemory, snapPoints } = (await useMemorySlider().catch(handleError)) a
4242}
4343
4444const editProfileObject = computed (() => {
45- const editProfile: {
46- java_path? : string
47- extra_launch_args? : string []
48- custom_env_vars? : string [][]
49- memory? : MemorySettings
50- } = {}
51-
52- if (overrideJavaInstall .value ) {
53- if (javaInstall .value .path !== ' ' ) {
54- editProfile .java_path = javaInstall .value .path .replace (' java.exe' , ' javaw.exe' )
55- }
56- }
57-
58- if (overrideJavaArgs .value ) {
59- editProfile .extra_launch_args = javaArgs .value .trim ().split (/ \s + / ).filter (Boolean )
60- }
61-
62- if (overrideEnvVars .value ) {
63- editProfile .custom_env_vars = envVars .value
64- .trim ()
65- .split (/ \s + / )
66- .filter (Boolean )
67- .map ((x ) => x .split (' =' ).filter (Boolean ))
68- }
69-
70- if (overrideMemorySettings .value ) {
71- editProfile .memory = memory .value
45+ return {
46+ java_path:
47+ overrideJavaInstall .value && javaInstall .value .path !== ' '
48+ ? javaInstall .value .path .replace (' java.exe' , ' javaw.exe' )
49+ : null ,
50+ extra_launch_args: overrideJavaArgs .value
51+ ? javaArgs .value .trim ().split (/ \s + / ).filter (Boolean )
52+ : null ,
53+ custom_env_vars: overrideEnvVars .value
54+ ? envVars .value
55+ .trim ()
56+ .split (/ \s + / )
57+ .filter (Boolean )
58+ .map ((x ) => x .split (' =' ).filter (Boolean ))
59+ : null ,
60+ memory: overrideMemorySettings .value ? memory .value : null ,
7261 }
73-
74- return editProfile
7562})
7663
7764watch (
0 commit comments