1
- function Controller ( ) { }
1
+ function Component ( )
2
+ {
3
+ component . forceInstallation = true ;
4
+ }
2
5
3
- Controller . prototype . TargetDirectoryPageCallback = function ( ) {
4
- var page = gui . pageWidgetByObjectName ( "TargetDirectoryPage" ) ;
6
+ Component . prototype . createOperations = function ( )
7
+ {
8
+ // Remove QtIFW internal installation marker
9
+ var installInfoPath = installer . value ( "TargetDir" ) + "/InstallationInformation" ;
10
+ var componentsXmlPath = installer . value ( "TargetDir" ) + "/components.xml" ;
5
11
6
- // Override the default validation function
7
- page . targetDirectoryLineEdit ( ) . textChanged . connect ( function ( dir ) {
8
- // Always allow the user to continue
9
- page . completeChanged ( ) ;
10
- } ) ;
12
+ if ( QFile . exists ( installInfoPath ) ) {
13
+ installer . performOperation ( "Delete" , installInfoPath ) ;
14
+ }
15
+ if ( QFile . exists ( componentsXmlPath ) ) {
16
+ installer . performOperation ( "Delete" , componentsXmlPath ) ;
17
+ }
11
18
12
- page . isComplete = function ( ) {
13
- var dir = page . targetDirectoryLineEdit ( ) . text ;
19
+ component . createOperations ( ) ; // must come after cleanup
14
20
15
- // If the directory exists and has an existing installation, we still allow it
16
- return true ;
17
- } ;
18
- } ;
21
+ // Your existing logic...
22
+ var exePath = installer . value ( "TargetDir" ) + "/{{ executable }}.exe" ;
23
+ var shortcutPath = installer . value ( "StartMenuDir" ) + "/{{ executable }}.lnk" ;
24
+
25
+ if ( installer . fileExists ( shortcutPath ) ) {
26
+ installer . performOperation ( "Delete" , shortcutPath ) ;
27
+ }
28
+
29
+ if ( systemInfo . productType === "windows" ) {
30
+ component . addOperation ( "CreateShortcut" ,
31
+ "@TargetDir@/{{ executable }}.exe" ,
32
+ "@StartMenuDir@/{{ executable }}.lnk" ,
33
+ "workingDirectory=@TargetDir@" ,
34
+ "iconPath=@TargetDir@/{{ iconfilename }}" ,
35
+ "description=Open {{ progname }}"
36
+ ) ;
37
+ }
38
+ }
0 commit comments