1- import { join , resourceDir , homeDir , configDir } from "@tauri-apps/api/path" ;
1+ import { join , resourceDir , homeDir } from "@tauri-apps/api/path" ;
22import * as fs from "@tauri-apps/plugin-fs" ;
33import { useKvPairs } from "@/helpers/use-kvpairs" ;
44import { useSettingsPageStatesStore } from "@/services/store" ;
55import { invoke } from "@tauri-apps/api/core" ;
6- import { useLogger } from "@/helpers/use-logger" ;
76
87interface FileMap {
98 source : string ;
@@ -13,7 +12,6 @@ interface FileMap {
1312
1413export function useLinuxRegisterer ( ) {
1514 const { saveKvPair } = useKvPairs ( ) ;
16- const LOG = useLogger ( ) ;
1715 const appVersion = useSettingsPageStatesStore ( state => state . appVersion ) ;
1816
1917 const registerToLinux = async ( ) => {
@@ -25,16 +23,18 @@ export function useLinuxRegisterer() {
2523 ] ;
2624
2725 const isFlatpak = await invoke < boolean > ( 'is_flatpak' ) ;
28- const resourceDirPath = isFlatpak ? '/app/lib/neodlp' : await resourceDir ( ) ;
26+ const resourceDirPath = await resourceDir ( ) ;
2927 const homeDirPath = await homeDir ( ) ;
30- const configDirPath = await configDir ( ) ;
3128
32- LOG . info ( "LINUX REGISTERER" , `Starting registration process. isFlatpak: ${ isFlatpak } , resourceDirPath: ${ resourceDirPath } , homeDirPath: ${ homeDirPath } , configDirPath: ${ configDirPath } ` ) ;
29+ if ( isFlatpak ) {
30+ saveKvPair ( 'linux_registered_version' , appVersion ) ;
31+ return { success : true , message : 'Registered successfully' }
32+ }
3333
3434 for ( const file of filesToCopy ) {
3535 const sourcePath = await join ( resourceDirPath , file . source ) ;
36- const destinationDir = isFlatpak ? await join ( configDirPath , file . dir ) : await join ( homeDirPath , file . dir ) ;
37- const destinationPath = isFlatpak ? await join ( configDirPath , file . destination ) : await join ( homeDirPath , file . destination ) ;
36+ const destinationDir = await join ( homeDirPath , file . dir ) ;
37+ const destinationPath = await join ( homeDirPath , file . destination ) ;
3838
3939 const dirExists = await fs . exists ( destinationDir ) ;
4040 if ( dirExists ) {
@@ -51,7 +51,6 @@ export function useLinuxRegisterer() {
5151 return { success : true , message : 'Registered successfully' }
5252 } catch ( error ) {
5353 console . error ( 'Error copying files:' , error ) ;
54- LOG . error ( "LINUX REGISTERER" , `Error during registration: ${ error } ` ) ;
5554 return { success : false , message : 'Failed to register' }
5655 }
5756 }
0 commit comments