1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12
3 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure
4 /*--------------------------------------------------------------------------
6 Purpose
: Import a system update
9 Author
(s
) : Andrew McMillan
10 ------------------------------------------------------------------------*/
11 DEF INPUT PARAMETER process-options
AS CHAR NO-UNDO.
13 DEF VAR preview
AS LOGI
NO-UNDO INITIAL No.
14 DEF VAR restart
AS LOGI
NO-UNDO INITIAL No.
15 DEF VAR update-zip
AS LOGI
NO-UNDO INITIAL No.
16 DEF VAR update-file-name
AS CHAR NO-UNDO INITIAL "../update.zip".
17 DEF VAR update-menus
AS LOGI
NO-UNDO INITIAL No.
18 DEF VAR compile-type
AS CHAR NO-UNDO INITIAL "".
19 DEF VAR program-list
AS CHAR NO-UNDO INITIAL "".
21 DEF VAR out-basename
AS CHAR NO-UNDO.
22 DEF VAR out-filename
AS CHAR NO-UNDO.
23 DEF VAR database-update
AS LOGICAL NO-UNDO INITIAL No.
24 DEF VAR conversions
AS CHAR NO-UNDO INITIAL "".
25 DEF VAR delta-filename
AS CHAR NO-UNDO INITIAL "".
29 INPUT FROM update-in-progress.LCK.
30 IMPORT UNFORMATTED out-basename.
31 IMPORT UNFORMATTED process-options.
33 process-options
= "Restart~n" + process-options.
40 DEF VAR user-name
AS CHAR NO-UNDO.
41 {inc
/username.i
"user-name"}
42 DEF VAR replication-on
AS LOGICAL NO-UNDO INITIAL No.
43 IF CAN-FIND( FIRST _File-Trig
WHERE _File-Trig._Event
BEGINS "REPLICATION") THEN
46 DEF VAR w1
AS WIDGET-HANDLE NO-UNDO.
47 DEF VAR prev-window
AS WIDGET-HANDLE NO-UNDO.
48 DEF VAR pw-handle
AS HANDLE NO-UNDO.
49 DEF VAR pw-amount
AS INTEGER NO-UNDO.
50 DEF VAR disk-limit
AS INTEGER NO-UNDO INITIAL 10000000.
51 DEF VAR log-depth
AS INTEGER NO-UNDO INITIAL 99.
52 DEF VAR log-file
AS CHAR NO-UNDO.
54 /* DEF VAR program-list
AS CHAR NO-UNDO.
*/
55 DEF VAR no-programs
AS INTEGER NO-UNDO.
57 DEF VAR current-dir
AS CHAR NO-UNDO.
59 DEFINE WORK-TABLE LN
NO-UNDO LIKE LinkNode.
60 DEFINE WORK-TABLE PL
NO-UNDO LIKE ProgramLink.
61 DEFINE WORK-TABLE UGRP
NO-UNDO LIKE UsrGroup.
62 DEFINE WORK-TABLE UGMN
NO-UNDO LIKE UsrGroupMenu.
63 DEFINE TEMP-TABLE UGMI
NO-UNDO LIKE UsrGroupMenuItem.
64 DEFINE WORK-TABLE UGRT
NO-UNDO LIKE UsrGroupRights.
66 DEF VAR compile-errors
AS INTEGER INITIAL 0 NO-UNDO.
68 DEF TEMP-TABLE ProgramList
NO-UNDO
69 FIELD ProgramName
AS CHAR
70 INDEX XPKProgramList
IS UNIQUE PRIMARY ProgramName.
72 /* _UIB-CODE-BLOCK-END
*/
76 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
78 /* ******************** Preprocessor Definitions
******************** */
80 &Scoped-define PROCEDURE-TYPE Procedure
81 &Scoped-define DB-AWARE no
85 /* _UIB-PREPROCESSOR-BLOCK-END
*/
89 /* ************************ Function Prototypes
********************** */
91 &IF DEFINED(EXCLUDE-disk-remaining) = 0 &THEN
93 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD disk-remaining Procedure
94 FUNCTION disk-remaining
RETURNS INTEGER
95 ( /* no parameter-definitions
*/ ) FORWARD.
97 /* _UIB-CODE-BLOCK-END
*/
102 &IF DEFINED(EXCLUDE-get-cwd) = 0 &THEN
104 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD get-cwd Procedure
105 FUNCTION get-cwd
RETURNS CHARACTER
106 ( /* parameter-definitions
*/ ) FORWARD.
108 /* _UIB-CODE-BLOCK-END
*/
114 /* *********************** Procedure Settings
************************ */
116 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
117 /* Settings for
THIS-PROCEDURE
121 Add Fields to
: Neither
122 Other Settings
: CODE-ONLY
COMPILE
124 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
126 /* ************************* Create Window
************************** */
128 &ANALYZE-SUSPEND _CREATE-WINDOW
129 /* DESIGN Window definition
(used by the UIB
)
130 CREATE WINDOW Procedure
ASSIGN
133 /* END WINDOW DEFINITION
*/
137 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure
138 /* ************************* Included-Libraries
*********************** */
140 {inc
/method
/m-txtrep.i
}
142 /* _UIB-CODE-BLOCK-END
*/
149 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure
152 /* *************************** Main Block
*************************** */
154 RUN apply-all-updates.
156 RUN log-current-settings.
159 IF compile-errors
> 0 OR update-menus
THEN DO:
160 RUN view-output-file
( Yes
).
161 OUTPUT TO "CLIPBOARD" KEEP-MESSAGES.
162 WAIT-FOR WINDOW-CLOSE
OF CURRENT-WINDOW .
166 MESSAGE "System Update Processing Complete" VIEW-AS ALERT-BOX INFORMATION.
170 IF compile-errors
> 0 THEN
171 MESSAGE compile-errors
"errors occurred during compilation!" SKIP(2)
172 "Please e-mail the following file to capital-helpdesk@catalyst.net.nz" SKIP
173 " '/" + "UPD" + out-basename
+ ".LOG'" SKIP(2)
175 VIEW-AS ALERT-BOX ERROR TITLE "Errors In Update".
177 MESSAGE "System Components Updated" VIEW-AS ALERT-BOX INFORMATION.
181 QUIT.
/* stop seems flakey under
8.2 */
182 ELSE IF database-update
THEN
185 /* _UIB-CODE-BLOCK-END
*/
189 /* ********************** Internal Procedures
*********************** */
191 &IF DEFINED(EXCLUDE-apply-all-updates) = 0 &THEN
193 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE apply-all-updates Procedure
194 PROCEDURE apply-all-updates
:
195 /*------------------------------------------------------------------------------
197 ------------------------------------------------------------------------------*/
198 DEF VAR i
AS INT NO-UNDO.
200 /* unpack the update zipfile
*/
201 IF update-zip
THEN RUN load-update.
203 /* lock the system
, saving appropriate options for anyone else
*/
204 OUTPUT TO update-in-progress.LCK .
205 PUT UNFORMATTED out-basename
SKIP.
206 PUT UNFORMATTED process-options
SKIP.
209 /* won't return from apply-delta
, except through restart after the update
*/
210 IF database-update
AND NOT restart
THEN RUN apply-delta.
212 /* compile programs where necessary
*/
213 IF compile-type
<> "" THEN RUN compile-programs.
215 /* run any conversion programs included in the update
*/
216 IF conversions
<> "" THEN DO:
217 DO i
= 1 TO NUM-ENTRIES( conversions
):
218 OUTPUT TO VALUE(out-filename
) KEEP-MESSAGES APPEND.
219 RUN VALUE( ENTRY( i
, conversions
) ) NO-ERROR.
224 /* unlock the system
*/
225 OS-DELETE update-in-progress.LCK .
227 /* Update the menus
*/
228 IF update-menus
THEN RUN update-menus.
232 /* _UIB-CODE-BLOCK-END
*/
237 &IF DEFINED(EXCLUDE-apply-delta) = 0 &THEN
239 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE apply-delta Procedure
240 PROCEDURE apply-delta
:
241 /*------------------------------------------------------------------------------
242 Purpose
: Apply the delta.df file
243 ------------------------------------------------------------------------------*/
244 DEF VAR i
AS INT NO-UNDO.
245 DEF VAR n
AS INT NO-UNDO.
247 RUN progress-begin
( "Preparing to apply database changes." ).
249 RUN progress-update
( "Building program list.", 9 ).
250 RUN process-dir
( ".", "*").
252 RUN progress-update
( "Removing r-code for all programs.", 9 ).
255 n
= NUM-ENTRIES( delta-filename
, "|" ) - 1.
257 RUN progress-update
( "Applying database differences from " + ENTRY(i
,delta-filename
,"|"), 9).
258 OUTPUT TO VALUE( out-filename
) KEEP-MESSAGES APPEND.
260 RUN prodict
/load_df.r
( ENTRY(i
,delta-filename
,"|") ).
265 RUN progress-update
( "Cleaning up and restarting.", 9 ).
269 STOP.
/* should restart things
*/
273 /* _UIB-CODE-BLOCK-END
*/
278 &IF DEFINED(EXCLUDE-clear-program-list) = 0 &THEN
280 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE clear-program-list Procedure
281 PROCEDURE clear-program-list
:
282 /*------------------------------------------------------------------------------
284 ------------------------------------------------------------------------------*/
285 FOR EACH ProgramList
: DELETE ProgramList.
END.
289 /* _UIB-CODE-BLOCK-END
*/
294 &IF DEFINED(EXCLUDE-compile-programs) = 0 &THEN
296 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE compile-programs Procedure
297 PROCEDURE compile-programs
:
298 /*------------------------------------------------------------------------------
299 Purpose
: Compile programs which arrived in the update.
300 ------------------------------------------------------------------------------*/
301 DEF VAR i
AS INT NO-UNDO.
302 DEF VAR prog-name
AS CHAR NO-UNDO.
303 DEF VAR r-name
AS CHAR NO-UNDO.
304 DEF VAR x-name
AS CHAR NO-UNDO.
305 DEF VAR last-pause
AS INT NO-UNDO.
307 IF compile-type
= "rest" OR compile-type
= "all" THEN RUN process-dir
( ".", "*" ).
309 RUN progress-begin
( "Compiling " + STRING( no-programs
) + " Programs" ).
310 IF NOT(compile-type
= "rest" OR restart
) THEN RUN remove-r-code.
314 FOR EACH ProgramList
:
315 /* ASSIGN dr
= disk-remaining
() NO-ERROR.
316 MESSAGE dr
VIEW-AS ALERT-BOX;
317 IF ((i
MOD 5) = 0) AND dr
< disk-limit
THEN DO:
318 OUTPUT TO VALUE( out-filename
) KEEP-MESSAGES APPEND.
319 MESSAGE "Less than" disk-limit
"temporary disk space remaining!" SKIP
320 "Program will exit - please restart manually to continue." SKIP
321 "compiling programs. (this works around a Progress bug)."
322 VIEW-AS ALERT-BOX WARNING.
329 IF (ETIME - last-pause
) > 10000 THEN DO:
333 prog-name
= ProgramList.ProgramName.
334 r-name
= SUBSTRING( prog-name
, 1, LENGTH(prog-name
) - 1) + "R".
335 x-name
= SUBSTRING( prog-name
, 1, LENGTH(prog-name
) - 1) + "X".
337 IF SEARCH( r-name
) = ?
AND SEARCH( x-name
) = ?
THEN DO:
338 pw-amount
= 5 + INTEGER( (i
* 95) / no-programs
).
339 RUN progress-update
( prog-name
, - pw-amount
).
342 OUTPUT TO VALUE( x-name
).
344 OUTPUT TO VALUE( out-filename
) KEEP-MESSAGES APPEND.
345 COMPILE VALUE( prog-name
) SAVE.
346 IF COMPILER:ERROR OR COMPILER:WARNING THEN DO:
347 compile-errors
= compile-errors
+ 1.
351 IF NOT(COMPILER:ERROR) THEN OS-DELETE VALUE( x-name
).
354 OUTPUT TO VALUE( x-name
).
355 COMPILE VALUE( prog-name
) SAVE NO-ERROR.
357 IF COMPILER:ERROR THEN DO:
358 compile-errors
= compile-errors
+ 1.
359 RUN log
( 6, "Error compiling " + prog-name
+ " - "
360 + COMPILER:FILENAME + " at line " + STRING( COMPILER:ERROR-ROW )
361 + " column " + STRING( COMPILER:ERROR-COL )).
362 IF COMPILER:STOPPED THEN RUN log
( 4, "Compilation stopped").
363 OUTPUT TO VALUE( out-filename
) KEEP-MESSAGES APPEND.
364 COMPILE VALUE( prog-name
) SAVE.
368 ELSE IF COMPILER:WARNING THEN DO:
369 OS-DELETE VALUE( x-name
).
370 RUN log
( 9, "Warning during compilation of " + prog-name
+ " - "
371 + COMPILER:FILENAME + " at line " + STRING( COMPILER:ERROR-ROW )
372 + " column " + STRING( COMPILER:ERROR-COL )).
373 OUTPUT TO VALUE( out-filename
) KEEP-MESSAGES APPEND.
374 COMPILE VALUE( prog-name
) SAVE.
379 OS-DELETE VALUE( x-name
).
382 END.
/* End the transaction
*/
386 IF compile-errors
> 0 THEN
387 RUN log
( 1, TRIM(STRING( compile-errors
)) + " programs failed to compile.").
391 /* _UIB-CODE-BLOCK-END
*/
396 &IF DEFINED(EXCLUDE-initialize) = 0 &THEN
398 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE initialize Procedure
399 PROCEDURE initialize
:
400 /*------------------------------------------------------------------------------
402 ------------------------------------------------------------------------------*/
403 DEF VAR i
AS INT NO-UNDO.
404 DEF VAR n
AS INT NO-UNDO.
406 current-dir
= get-cwd
().
408 IF NOT(restart
) THEN DO:
409 out-basename
= "-" + STRING(YEAR(TODAY)) + STRING(MONTH(TODAY), "99") + STRING(DAY(TODAY), "99")
410 + "-" + REPLACE( STRING( TIME, "HH:MM:SS"), ":", "") .
412 out-filename
= "../UPD" + out-basename
+ ".LOG" .
414 FIND UsrGroupMember
WHERE UsrGroupMember.UserName
= user-name
415 AND UsrGroupMember.GroupName
= "Programmer"
417 IF preview
OR AVAILABLE(UsrGroupMember
) THEN ASSIGN
419 txtrep-print-file
= out-filename.
421 IF compile-type
= "List" THEN DO:
422 n
= NUM-ENTRIES( program-list
, "~n").
424 RUN make-program-list
( ENTRY( i
, program-list
, "~n") ).
430 /* _UIB-CODE-BLOCK-END
*/
435 &IF DEFINED(EXCLUDE-load-update) = 0 &THEN
437 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE load-update Procedure
438 PROCEDURE load-update
:
439 /*------------------------------------------------------------------------------
440 Purpose
: Unzip the update file
(in the root directory
).
441 ------------------------------------------------------------------------------*/
442 DEF VAR import-line
AS CHAR NO-UNDO.
443 DEF VAR action
AS CHAR NO-UNDO.
444 DEF VAR file-name
AS CHAR NO-UNDO.
445 DEF VAR file-type
AS CHAR NO-UNDO.
446 DEF VAR full-path
AS CHAR NO-UNDO.
447 DEF VAR top-dir
AS CHAR NO-UNDO.
448 DEF VAR top-dir-len
AS INT NO-UNDO.
449 DEF VAR dot-pos
AS INT NO-UNDO.
451 top-dir
= REPLACE( current-dir
, "~\", "/").
452 top-dir
= SUBSTRING( top-dir
, R-INDEX(top-dir
,"/") + 1).
453 top-dir-len
= LENGTH(top-dir
).
455 IF update-zip
THEN DO:
456 OUTPUT TO update.bat
KEEP-MESSAGES.
458 PUT 'REM pkunzip
-do update
>zip-out.txt'
SKIP.
459 PUT UNFORMATTED 'unzip
-o ' update-file-name '
>zip-out.txt'
SKIP.
462 OS-COMMAND SILENT update.bat .
463 /* OS-DELETE update.bat .
*/
466 INPUT FROM ..
/zip-out.txt .
468 IMPORT UNFORMATTED import-line.
469 import-line
= TRIM(import-line
).
470 RUN log
( 4, "unzipping: " + import-line
).
471 file-name
= ENTRY( 2, import-line
, ' '
).
472 full-path
= SUBSTRING( file-name
, top-dir-len
+ 2).
473 dot-pos
= R-INDEX( file-name
, ".").
474 file-type
= (IF dot-pos
> 0 THEN SUBSTRING( file-name
, dot-pos
) ELSE "UNKNOWN").
475 IF SUBSTRING( file-name
, 1, top-dir-len
) = top-dir
476 AND (file-type
= ".p" OR file-type
= ".w") THEN DO:
477 FIND ProgramList
WHERE ProgramList.ProgramName
= full-path
NO-ERROR.
478 RUN log
( 9, "Program to be compiled.").
479 IF NOT AVAILABLE(ProgramList
) THEN DO:
481 ProgramList.ProgramName
= full-path.
482 no-programs
= no-programs
+ 1.
484 IF INDEX( full-path
, "runme" ) > 0 THEN
485 conversions
= conversions
+ full-path
+ ",".
487 ELSE IF SUBSTRING( file-name
, 1, top-dir-len
+ 4) = top-dir
+ "/lnk" AND file-type
= ".d" THEN DO:
489 RUN log
( 9, "Menu update: " + full-path
).
491 ELSE IF SUBSTRING( file-name
, 1, top-dir-len
) = top-dir
AND file-type
= ".df" THEN DO:
492 database-update
= yes.
493 delta-filename
= delta-filename
+ full-path
+ "|".
494 RUN log
( 9, "Database update: " + delta-filename
).
497 RUN log
( 15, "Line not relevant").
502 OS-DELETE ..
/zip-out.txt.
503 OS-RENAME ..
/update.zip
VALUE( "../upd" + out-basename
+ ".zip" ).
505 IF CAN-FIND( FIRST ProgramList
) THEN compile-type
= "list".
510 /* _UIB-CODE-BLOCK-END
*/
515 &IF DEFINED(EXCLUDE-log) = 0 &THEN
517 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE log Procedure
519 /*------------------------------------------------------------------------------
520 Purpose
: write output formatted as a log entry
521 ------------------------------------------------------------------------------*/
522 DEF INPUT PARAMETER depth
AS INT NO-UNDO.
523 DEF INPUT PARAMETER entry-text
AS CHAR NO-UNDO.
525 IF depth
> log-depth
THEN RETURN.
526 OUTPUT TO VALUE(out-filename
) KEEP-MESSAGES APPEND.
527 PUT UNFORMATTED STRING( YEAR(TODAY), "9999") + "-" + STRING( MONTH(TODAY), "99") + "-" + STRING( DAY(TODAY), "99")
528 + " " + STRING( TIME, "HH:MM:SS")
529 + " " + STRING( depth
, ">>9")
536 /* _UIB-CODE-BLOCK-END
*/
541 &IF DEFINED(EXCLUDE-log-current-settings) = 0 &THEN
543 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE log-current-settings Procedure
544 PROCEDURE log-current-settings
:
545 /*------------------------------------------------------------------------------
547 ------------------------------------------------------------------------------*/
549 FIND Office
WHERE Office.ThisOffice
NO-LOCK NO-ERROR.
550 IF NOT AVAILABLE(Office
) THEN DO:
551 RUN log
( 0, "No current office set!!!" ).
554 RUN log
( 1, "Office: " + Office.OfficeCode
+ " - " + Office.Name
).
555 RUN log
( 2, "OfficeGST: " + STRING(Office.GST
) + " - " + STRING( Office.GSTNo
) ).
556 RUN log
( 2, "Address: " + REPLACE( REPLACE( Office.StreetAddress
, "~r", "~~r"), "~n", "~~n") ).
558 RUN log
( 9, "Office Control Accounts:" ).
559 FOR EACH OfficeControlAccount
OF Office
NO-LOCK:
560 RUN log
( 9, "Name: " + STRING(OfficeControlAccount.Name
, "X(14)")
561 + (IF OfficeControlAccount.EntityType
<> ?
THEN OfficeControlAccount.EntityType
ELSE "?")
562 + "-" + (IF OfficeControlAccount.EntityCode
<> ?
THEN STRING( OfficeControlAccount.EntityCode
, "99999") ELSE "?????")
563 + "-" + (IF OfficeControlAccount.AccountCode
<> ?
THEN STRING( OfficeControlAccount.AccountCode
, "9999.99") ELSE "????.??")
564 + " " + OfficeControlAccount.Description
).
567 RUN log
( 9, "Office Settings:" ).
568 FOR EACH OfficeSetting
OF Office
NO-LOCK:
569 RUN log
( 9, "Setting: >>" + OfficeSetting.SetName
+ "<<" ).
570 RUN log
( 9, ">>" + OfficeSetting.SetValue
+ "<<" ).
575 /* _UIB-CODE-BLOCK-END
*/
580 &IF DEFINED(EXCLUDE-make-program-list) = 0 &THEN
582 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE make-program-list Procedure
583 PROCEDURE make-program-list
:
584 /*------------------------------------------------------------------------------
586 ------------------------------------------------------------------------------*/
587 DEF INPUT PARAMETER wild-spec
AS CHAR NO-UNDO.
589 DEF VAR first-bit
AS CHAR NO-UNDO.
590 DEF VAR path-bit
AS CHAR NO-UNDO.
591 DEF VAR wild-bit
AS CHAR NO-UNDO.
593 DEF VAR splitter
AS CHAR NO-UNDO INITIAL "~\".
594 IF OPSYS = "UNIX" THEN splitter
= "/".
596 DEF VAR wild-spot
AS INT NO-UNDO.
597 DEF VAR first-split
AS INT NO-UNDO.
598 DEF VAR last-split
AS INT NO-UNDO.
600 DEF VAR end-of-list
AS INT NO-UNDO.
602 IF TRIM( wild-spec
) = "" THEN RETURN.
603 IF INDEX( wild-spec
, splitter
) = 0 THEN
604 wild-spec
= REPLACE( wild-spec
, "/", splitter
).
606 first-split
= INDEX( wild-spec
, splitter
).
607 last-split
= R-INDEX( wild-spec
, splitter
).
608 wild-spot
= MAXIMUM( INDEX( wild-spec
, "*", MAXIMUM(last-split
, 1)),
609 INDEX( wild-spec
, "?", MAXIMUM(last-split
, 1)),
610 INDEX( wild-spec
, ".", MAXIMUM(last-split
, 1)) ).
612 IF wild-spot
<> 0 AND first-split
<> 0 THEN ASSIGN
613 path-bit
= SUBSTR( wild-spec
, 1, last-split
- 1)
614 wild-bit
= SUBSTR( wild-spec
, last-split
+ 1).
615 ELSE IF first-split
<> 0 THEN ASSIGN
618 ELSE IF wild-spot
<> 0 THEN ASSIGN
620 wild-bit
= wild-spec.
622 first-bit
= SUBSTR( path-bit
, 1, 1).
623 IF first-bit
= splitter
THEN path-bit
= "." + path-bit.
624 ELSE IF first-bit
<> "." THEN path-bit
= "." + splitter
+ path-bit.
625 IF path-bit
= ("." + splitter
) THEN path-bit
= ".".
627 wild-bit
= REPLACE( wild-bit
, ".", "~~.").
628 wild-bit
= REPLACE( wild-bit
, "?", ".").
630 RUN log
( 12, "Parsed >>" + wild-spec
+ "<< into >>" + path-bit
+ "<< and >>" + wild-bit
+ "<<" ).
631 RUN process-dir
( path-bit
, wild-bit
).
632 RUN log
( 12, STRING(no-programs
) + " programs to compile").
636 /* _UIB-CODE-BLOCK-END
*/
641 &IF DEFINED(EXCLUDE-parse-parameters) = 0 &THEN
643 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE parse-parameters Procedure
644 PROCEDURE parse-parameters
:
645 /*------------------------------------------------------------------------------
647 ------------------------------------------------------------------------------*/
648 DEF VAR token
AS CHAR NO-UNDO.
649 DEF VAR i
AS INT NO-UNDO.
650 DEF VAR n
AS INT NO-UNDO.
651 DEF VAR use-program-list
AS LOGI
NO-UNDO INITIAL No.
653 {inc
/showopts.i
"process-options"}
655 n
= NUM-ENTRIES( process-options
, "~n" ).
657 token
= ENTRY( i
, process-options
, "~n" ).
658 IF use-program-list
THEN
659 program-list
= program-list
+ token
+ "~n".
661 CASE ENTRY( 1, token
):
662 WHEN "Preview" THEN preview
= Yes.
663 WHEN "UpdateMenus" THEN update-menus
= Yes.
664 WHEN "Compile" THEN compile-type
= ENTRY(2,token
).
665 WHEN "Restart" THEN restart
= Yes.
666 WHEN "ProgramList" THEN use-program-list
= Yes.
668 WHEN "UpdateFile" THEN ASSIGN
670 update-file-name
= SUBSTRING( token
, INDEX(token
,",") + 1).
679 /* _UIB-CODE-BLOCK-END
*/
684 &IF DEFINED(EXCLUDE-process-dir) = 0 &THEN
686 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE process-dir Procedure
687 PROCEDURE process-dir
:
688 /*------------------------------------------------------------------------------
689 Purpose
: Create ProgramList records for programs in a directory
690 ------------------------------------------------------------------------------*/
691 DEF INPUT PARAMETER path
AS CHAR FORMAT "X(30)" NO-UNDO.
692 DEF INPUT PARAMETER spec
AS CHAR NO-UNDO.
694 DEF VAR r-name
AS CHAR NO-UNDO.
695 DEF VAR file-name
AS CHAR NO-UNDO.
696 DEF VAR full-path
AS CHAR NO-UNDO.
697 DEF VAR file-type
AS CHAR NO-UNDO.
699 DEF VAR dir-list
AS CHAR INITIAL "" NO-UNDO.
700 DEF VAR no-dirs
AS INT NO-UNDO.
701 DEF VAR i
AS INT NO-UNDO.
703 DEF VAR keep-at-it
AS LOGICAL INITIAL yes
NO-UNDO.
705 INPUT FROM OS-DIR( path
) .
707 IMPORT file-name full-path file-type.
708 file-type
= SUBSTRING( file-type
, 1, 1).
709 IF SUBSTRING( file-name
, 1, 1) = "." THEN NEXT.
/* skip .
, ..
, ... etc.
*/
710 IF replication-on
= No
AND file-name
MATCHES "*rplctn*" THEN NEXT.
713 dir-list
= dir-list
+ (IF dir-list
= "" THEN "" ELSE ",") + path
+ "/" + file-name.
716 full-path
= SUBSTRING( file-name
, MAX(1, LENGTH(file-name
) - 1), 2).
717 IF file-name
MATCHES spec
AND (full-path
= ".P" OR full-path
= ".W") THEN DO:
718 full-path
= path
+ '
/'
+ file-name.
719 FIND ProgramList
WHERE ProgramList.ProgramName
= full-path
NO-ERROR.
720 IF NOT AVAILABLE(ProgramList
) THEN DO:
721 r-name
= SUBSTRING( full-path
, 1, LENGTH(full-path
) - 1) + "R".
722 IF compile-type
<> "rest" OR SEARCH( r-name
) = ?
THEN DO TRANSACTION:
724 ProgramList.ProgramName
= full-path.
725 no-programs
= no-programs
+ 1.
729 ELSE IF full-path
= ".X" THEN DO:
730 OS-DELETE VALUE( path
+ '
/'
+ file-name
).
738 no-dirs
= NUM-ENTRIES( dir-list
).
740 full-path
= ENTRY( i
, dir-list
).
741 RUN process-dir
( full-path
, spec
).
746 /* _UIB-CODE-BLOCK-END
*/
751 &IF DEFINED(EXCLUDE-progress-begin) = 0 &THEN
753 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE progress-begin Procedure
754 PROCEDURE progress-begin
:
755 /*------------------------------------------------------------------------------
757 ------------------------------------------------------------------------------*/
758 DEF INPUT PARAMETER title-text
AS CHAR NO-UNDO.
761 ASSIGN TITLE = title-text
767 prev-window
= CURRENT-WINDOW.
770 RUN win
/w-prgmsg.w
PERSISTENT SET pw-handle.
771 RUN dispatch
IN pw-handle
( 'initialize'
:U
).
772 RUN set-title
IN pw-handle
( title-text
).
775 RUN log
( 5, title-text
).
779 /* _UIB-CODE-BLOCK-END
*/
784 &IF DEFINED(EXCLUDE-progress-end) = 0 &THEN
786 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE progress-end Procedure
787 PROCEDURE progress-end
:
788 /*------------------------------------------------------------------------------
790 ------------------------------------------------------------------------------*/
791 RUN log
( 3, w1
:TITLE + " - Processing Complete").
792 RUN dispatch
IN pw-handle
( 'destroy'
:U
).
793 CURRENT-WINDOW = prev-window.
798 /* _UIB-CODE-BLOCK-END
*/
803 &IF DEFINED(EXCLUDE-progress-update) = 0 &THEN
805 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE progress-update Procedure
806 PROCEDURE progress-update
:
807 /*------------------------------------------------------------------------------
809 ------------------------------------------------------------------------------*/
810 DEF INPUT PARAMETER description
AS CHAR NO-UNDO.
811 DEF INPUT PARAMETER increment
AS INT NO-UNDO.
813 IF increment
< 0 THEN pw-amount
= - increment.
ELSE pw-amount
= pw-amount
+ increment.
814 RUN update-details
IN pw-handle
( description
, pw-amount
).
815 RUN log
( 5, description
).
819 /* _UIB-CODE-BLOCK-END
*/
824 &IF DEFINED(EXCLUDE-remove-r-code) = 0 &THEN
826 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE remove-r-code Procedure
827 PROCEDURE remove-r-code
:
828 /*------------------------------------------------------------------------------
832 ------------------------------------------------------------------------------*/
833 DEF VAR last-amount
AS INT NO-UNDO INITIAL -9999.
834 DEF VAR pw-amount
AS INT NO-UNDO.
835 DEF VAR i
AS INT NO-UNDO.
836 DEF VAR r-name
AS CHAR NO-UNDO.
837 DEF VAR prog-name
AS CHAR NO-UNDO.
839 /* remove existing r-code
*/
841 FOR EACH ProgramList
:
844 pw-amount
= INTEGER( (i
* 5) / no-programs
).
845 IF pw-amount
<> last-amount
THEN DO:
846 RUN progress-update
( "Removing existing r-code", 1 ).
847 last-amount
= pw-amount.
850 prog-name
= ProgramList.ProgramName.
851 r-name
= SUBSTRING( prog-name
, 1, LENGTH(prog-name
) - 1) + "R".
852 OS-DELETE VALUE( r-name
).
858 /* _UIB-CODE-BLOCK-END
*/
863 &IF DEFINED(EXCLUDE-update-group-items) = 0 &THEN
865 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-group-items Procedure
866 PROCEDURE update-group-items
:
867 /*------------------------------------------------------------------------------
869 ------------------------------------------------------------------------------*/
870 DEF VAR i
AS INT NO-UNDO.
871 DEF VAR cmp-result
AS LOGICAL NO-UNDO.
874 RUN progress-update
( "Loading User Group Menu Items", 1 ).
875 INPUT FROM {&LINK-DIR}/UsrGrpMi.d.
877 REPEAT: i
= i
+ 1.
CREATE UGMI.
IMPORT UGMI.
END.
879 DELETE UGMI.
/* table is
NO-UNDO.
*/
880 RUN log
( 35, STRING( i
) + " records loaded." ).
883 RUN progress-update
( "Reconstructing User Group Menu Items", 6).
884 FOR EACH UsrGroupMenuItem
BY UsrGroupMenuItem.LinkCode
TRANSACTION:
885 FIND FIRST UGMI
WHERE UGMI.LinkCode
= UsrGroupMenuItem.LinkCode
886 AND UGMI.MenuName
= UsrGroupMenuItem.MenuName
887 AND UGMI.GroupName
= UsrGroupMenuItem.GroupName
NO-ERROR.
888 IF AVAILABLE(UGMI
) THEN DO:
889 BUFFER-COMPARE UsrGroupMenuItem
TO UGMI
SAVE cmp-result.
890 IF NOT(cmp-result
) THEN DO:
891 BUFFER-COPY UGMI
TO UsrGroupMenuItem.
892 RUN log
( 25, "Changing user group menu " + STRING( UsrGroupMenuItem.LinkCode
) + " - "
893 + UsrGroupMenuItem.GroupName
+ ", "
894 + UsrGroupMenuItem.MenuName
+ ", "
895 + UsrGroupMenuItem.ButtonLabel
).
900 RUN log
( 25, "Deleting user group menu " + STRING( UsrGroupMenuItem.LinkCode
) + " - "
901 + UsrGroupMenuItem.GroupName
+ ", "
902 + UsrGroupMenuItem.MenuName
+ ", "
903 + UsrGroupMenuItem.ButtonLabel
).
904 DELETE UsrGroupMenuItem.
908 RUN progress-update
("Creating new User Group Menu Items", 17).
909 FOR EACH UGMI
TRANSACTION:
910 CREATE UsrGroupMenuItem.
911 BUFFER-COPY UGMI
TO UsrGroupMenuItem.
912 RUN log
( 25, "Creating user group menu " + STRING( UsrGroupMenuItem.LinkCode
) + " - "
913 + UsrGroupMenuItem.GroupName
+ ", "
914 + UsrGroupMenuItem.MenuName
+ ", "
915 + UsrGroupMenuItem.ButtonLabel
).
918 RUN progress-update
( "User/Group Menu Items update complete", 4).
922 /* _UIB-CODE-BLOCK-END
*/
927 &IF DEFINED(EXCLUDE-update-group-menus) = 0 &THEN
929 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-group-menus Procedure
930 PROCEDURE update-group-menus
:
931 /*------------------------------------------------------------------------------
933 ------------------------------------------------------------------------------*/
934 DEF VAR i
AS INT NO-UNDO.
935 DEF VAR cmp-result
AS LOGICAL NO-UNDO.
938 RUN progress-update
( "Loading User Group Menus", 1 ).
939 INPUT FROM {&LINK-DIR}/UsrGrpMn.d.
941 REPEAT: i
= i
+ 1.
CREATE UGMN.
IMPORT UGMN.
END.
943 DELETE UGMN.
/* table is
NO-UNDO.
*/
944 RUN log
( 35, STRING( i
) + " records loaded." ).
947 RUN progress-update
( "Reconstructing User Group Menus", 2).
948 FOR EACH UsrGroupMenu
TRANSACTION:
949 FIND FIRST UGMN
WHERE UGMN.NodeCode
= UsrGroupMenu.NodeCode
950 AND UGMN.MenuName
= UsrGroupMenu.MenuName
951 AND UGMN.GroupName
= UsrGroupMenu.GroupName
NO-ERROR.
952 IF AVAILABLE(UGMN
) THEN DO:
953 BUFFER-COMPARE UsrGroupMenu
TO UGMN
SAVE cmp-result.
954 IF NOT(cmp-result
) THEN DO:
955 BUFFER-COPY UGMN
TO UsrGroupMenu.
956 RUN log
( 25, "Changing user group menu " + STRING( UsrGroupMenu.NodeCode
) + " - "
957 + UsrGroupMenu.GroupName
+ ", " + UsrGroupMenu.MenuName
).
962 RUN log
( 25, "Deleting user group menu " + STRING( UsrGroupMenu.NodeCode
) + " - "
963 + UsrGroupMenu.GroupName
+ ", " + UsrGroupMenu.MenuName
).
968 RUN progress-update
("Creating new User Group Menus", 9).
969 FOR EACH UGMN
TRANSACTION:
971 BUFFER-COPY UGMN
TO UsrGroupMenu.
972 RUN log
( 25, "Creating user group menu " + STRING( UsrGroupMenu.NodeCode
) + " - "
973 + UsrGroupMenu.GroupName
+ ", " + UsrGroupMenu.MenuName
).
976 RUN progress-update
( "User/Group Menus update complete", 3).
980 /* _UIB-CODE-BLOCK-END
*/
985 &IF DEFINED(EXCLUDE-update-group-rights) = 0 &THEN
987 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-group-rights Procedure
988 PROCEDURE update-group-rights
:
989 /*------------------------------------------------------------------------------
991 ------------------------------------------------------------------------------*/
992 DEF VAR i
AS INT NO-UNDO.
993 DEF VAR cmp-result
AS LOGICAL NO-UNDO.
996 RUN progress-update
( "Loading User Group Rights", 1 ).
997 INPUT FROM {&LINK-DIR}/UGRights.d.
999 REPEAT: i
= i
+ 1.
CREATE UGRT.
IMPORT UGRT.
END.
1001 DELETE UGRT.
/* table is
NO-UNDO.
*/
1002 RUN log
( 35, STRING( i
) + " records loaded." ).
1005 RUN progress-update
( "Reconstructing User Group Rights", 2).
1006 FOR EACH UsrGroupRights
TRANSACTION:
1007 FIND FIRST UGRT
WHERE UGRT.GroupName
= UsrGroupRights.GroupName
1008 AND UGRT.ApplicationCode
= UsrGroupRights.ApplicationCode
1009 AND UGRT.Action
= UsrGroupRights.Action
NO-ERROR.
1010 IF AVAILABLE(UGRT
) THEN DO:
1011 BUFFER-COMPARE UsrGroupRights
TO UGRT
SAVE cmp-result.
1012 IF NOT(cmp-result
) THEN DO:
1013 BUFFER-COPY UGRT
TO UsrGroupRights.
1014 RUN log
( 15, "Changing user group right " + STRING( UsrGroupRights.GroupName
) + " - "
1015 + UsrGroupRights.ApplicationCode
+ ", " + UsrGroupRights.Action
1016 + ": " + STRING( UsrGroupRights.Rights
)).
1021 RUN log
( 15, "Deleting user group right " + STRING( UsrGroupRights.GroupName
) + " - "
1022 + UsrGroupRights.ApplicationCode
+ ", " + UsrGroupRights.Action
1023 + ": " + STRING( UsrGroupRights.Rights
)).
1024 DELETE UsrGroupRights.
1028 RUN progress-update
("Creating new User Group Rights", 6).
1029 FOR EACH UGRT
TRANSACTION:
1030 CREATE UsrGroupRights.
1031 BUFFER-COPY UGRT
TO UsrGroupRights.
1032 RUN log
( 15, "Creating user group right " + STRING( UsrGroupRights.GroupName
) + " - "
1033 + UsrGroupRights.ApplicationCode
+ ", " + UsrGroupRights.Action
1034 + ": " + STRING( UsrGroupRights.Rights
)).
1037 RUN progress-update
( "User Group Rights update complete", 4).
1041 /* _UIB-CODE-BLOCK-END
*/
1046 &IF DEFINED(EXCLUDE-update-groups) = 0 &THEN
1048 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-groups Procedure
1049 PROCEDURE update-groups
:
1050 /*------------------------------------------------------------------------------
1052 ------------------------------------------------------------------------------*/
1053 DEF VAR i
AS INT NO-UNDO.
1054 DEF VAR cmp-result
AS LOGICAL NO-UNDO.
1057 RUN progress-update
( "Loading User Groups", 1 ).
1058 INPUT FROM {&LINK-DIR}/UsrGroup.d.
1060 REPEAT: i
= i
+ 1.
CREATE UGRP.
IMPORT UGRP.
END.
1062 DELETE UGRP.
/* table is
NO-UNDO.
*/
1063 RUN log
( 35, STRING( i
) + " records loaded." ).
1066 RUN progress-update
( "Reconstructing User Groups", 2).
1067 FOR EACH UsrGroup
TRANSACTION:
1068 FIND FIRST UGRP
WHERE UGRP.GroupName
= UsrGroup.GroupName
NO-ERROR.
1069 IF AVAILABLE(UGRP
) THEN DO:
1070 BUFFER-COMPARE UsrGroup
TO UGRP
SAVE cmp-result.
1071 IF NOT(cmp-result
) THEN DO:
1072 RUN log
( 15, "Changing user group " + STRING( UsrGroup.GroupName
) + " - "
1073 + UsrGroup.Description
+ ", " + STRING(UsrGroup.Sequence
) ).
1074 BUFFER-COPY UGRP
TO UsrGroup.
1075 RUN log
( 15, "Changed to: " + STRING( UsrGroup.GroupName
) + " - "
1076 + UsrGroup.Description
+ ", " + STRING(UsrGroup.Sequence
) ).
1081 RUN log
( 15, "Deleting user group " + STRING( UsrGroup.GroupName
) + " - "
1082 + UsrGroup.Description
+ ", " + STRING(UsrGroup.Sequence
) ).
1087 RUN progress-update
("Creating new User Groups", 3).
1088 FOR EACH UGRP
TRANSACTION:
1090 BUFFER-COPY UGRP
TO UsrGroup.
1091 RUN log
( 15, "Creating user group " + STRING( UsrGroup.GroupName
) + " - "
1092 + UsrGroup.Description
+ ", " + STRING(UsrGroup.Sequence
) ).
1095 RUN progress-update
( "User Groups update complete", 2).
1099 /* _UIB-CODE-BLOCK-END
*/
1104 &IF DEFINED(EXCLUDE-update-link-tables) = 0 &THEN
1106 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-link-tables Procedure
1107 PROCEDURE update-link-tables
:
1108 /*------------------------------------------------------------------------------
1110 ------------------------------------------------------------------------------*/
1111 DEF VAR i
AS INT NO-UNDO.
1112 DEF VAR cmp-result
AS LOGICAL NO-UNDO.
1115 RUN progress-update
( "Loading Link Nodes", 1 ).
1116 INPUT FROM {&LINK-DIR}/linknode.d.
1118 REPEAT: i
= i
+ 1.
CREATE LN.
IMPORT LN.
END.
1120 DELETE LN.
/* table is
NO-UNDO.
*/
1121 RUN log
( 35, STRING( i
) + " records loaded." ).
1124 RUN progress-update
( "Applying Link Node changes", 3 ).
1125 FOR EACH LinkNode
TRANSACTION:
1126 FIND FIRST LN
WHERE LN.NodeCode
= LinkNode.NodeCode
NO-ERROR.
1127 IF AVAILABLE(LN
) THEN DO:
1128 BUFFER-COMPARE LinkNode
TO LN
SAVE cmp-result.
1129 IF NOT(cmp-result
) THEN DO:
1130 BUFFER-COPY LN
TO LinkNode.
1131 RUN log
( 25, "Changing LinkNode " + STRING( LinkNode.NodeCode
) + ": "
1132 + LinkNode.NodeType
+ ", " + LinkNode.Description
).
1137 RUN log
( 25, "Deleting node " + STRING( LinkNode.NodeCode
) + ": "
1138 + LinkNode.NodeType
+ ", " + LinkNode.Description
).
1143 RUN progress-update
( "Creating new link nodes", 7 ).
1146 BUFFER-COPY LN
TO LinkNode.
1147 RUN log
( 25, "Creating LinkNode " + STRING( LinkNode.NodeCode
) + ": "
1148 + LinkNode.NodeType
+ ", " + LinkNode.Description
).
1152 RUN progress-update
( "Loading Program Links", 2 ).
1153 INPUT FROM {&LINK-DIR}/ProgramL.d.
1155 REPEAT: i
= i
+ 1.
CREATE PL.
IMPORT PL.
END.
1157 DELETE PL.
/* table is
NO-UNDO.
*/
1158 RUN log
( 35, STRING( i
) + " records loaded." ).
1160 RUN progress-update
( "Applying Program Link changes", 4 ).
1161 FOR EACH ProgramLink
:
1162 FIND FIRST PL
WHERE PL.LinkCode
= ProgramLink.LinkCode
NO-ERROR.
1163 IF AVAILABLE(PL
) THEN DO:
1164 BUFFER-COMPARE ProgramLink
TO PL
SAVE cmp-result.
1165 IF NOT(cmp-result
) THEN DO:
1166 BUFFER-COPY PL
TO ProgramLink.
1167 RUN log
( 25, "Changing node " + STRING( ProgramLink.LinkCode
) + ": "
1168 + ProgramLink.LinkType
+ ", "
1169 + ProgramLink.ButtonLabel
+ ", "
1170 + ProgramLink.Description
).
1175 RUN log
( 25, "Deleting node " + STRING( ProgramLink.LinkCode
) + ": "
1176 + ProgramLink.LinkType
+ ", "
1177 + ProgramLink.ButtonLabel
+ ", "
1178 + ProgramLink.Description
).
1183 RUN progress-update
( "Creating new Program Links", 15 ).
1186 BUFFER-COPY PL
TO ProgramLink.
1187 RUN log
( 25, "Creating programlink " + STRING( ProgramLink.LinkCode
) + ": "
1188 + ProgramLink.LinkType
+ ", "
1189 + ProgramLink.ButtonLabel
+ ", "
1190 + ProgramLink.Description
).
1192 RUN progress-update
( "Link Tables Update Complete", 3 ).
1196 /* _UIB-CODE-BLOCK-END
*/
1201 &IF DEFINED(EXCLUDE-update-menus) = 0 &THEN
1203 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE update-menus Procedure
1204 PROCEDURE update-menus
:
1205 /*------------------------------------------------------------------------------
1206 Purpose
: Update the menu details
1207 ------------------------------------------------------------------------------*/
1208 RUN progress-begin
( "Rebuilding Menus" ).
1210 RUN update-link-tables.
1212 RUN update-group-rights.
1213 RUN update-group-menus.
1214 RUN update-group-items.
1221 /* _UIB-CODE-BLOCK-END
*/
1226 /* ************************ Function Implementations
***************** */
1228 &IF DEFINED(EXCLUDE-disk-remaining) = 0 &THEN
1230 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION disk-remaining Procedure
1231 FUNCTION disk-remaining
RETURNS INTEGER
1232 ( /* no parameter-definitions
*/ ) :
1233 /*------------------------------------------------------------------------------
1234 Purpose
: Return the amount of free disk on the temp drive
1236 ------------------------------------------------------------------------------*/
1237 DEF VAR in-line
AS CHAR NO-UNDO.
1238 DEF VAR result
AS INT NO-UNDO.
1239 DEF VAR pos
AS INT NO-UNDO.
1241 OS-COMMAND SILENT VALUE('
DIR "' + SESSION:TEMP-DIRECTORY + '" >"' + SESSION:TEMP-DIRECTORY + '/DSKRMN.TXT"'
).
1243 INPUT FROM VALUE(SESSION:TEMP-DIRECTORY + '
/DSKRMN.TXT'
).
1245 IMPORT UNFORMATTED in-line.
1246 pos
= INDEX( in-line
, "bytes free").
1248 in-line
= TRIM( SUBSTRING(in-line
, 1, pos
- 1)).
1249 in-line
= ENTRY( NUM-ENTRIES(in-line
," "), in-line
, " ").
1250 in-line
= REPLACE(in-line
, ",", "").
1252 RETURN INT(in-line
).
1262 /* _UIB-CODE-BLOCK-END
*/
1267 &IF DEFINED(EXCLUDE-get-cwd) = 0 &THEN
1269 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION get-cwd Procedure
1270 FUNCTION get-cwd
RETURNS CHARACTER
1271 ( /* parameter-definitions
*/ ) :
1272 /*------------------------------------------------------------------------------
1275 ------------------------------------------------------------------------------*/
1276 DEF VAR temp-batfile
AS CHAR NO-UNDO.
1277 DEF VAR current-dir
AS CHAR NO-UNDO.
1279 temp-batfile
= "getcwd.bat".
1280 OUTPUT TO VALUE(temp-batfile
) KEEP-MESSAGES.
1281 PUT UNFORMATTED 'cd
>'
+ 'this-dir.txt'
SKIP.
1284 OS-COMMAND SILENT VALUE(temp-batfile
).
1286 INPUT FROM this-dir.txt.
1287 IMPORT UNFORMATTED current-dir.
1290 OS-DELETE this-dir.txt.
1291 OS-DELETE VALUE(temp-batfile
).
1297 /* _UIB-CODE-BLOCK-END
*/