Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fileExists command (2.02) #1410

Merged
merged 4 commits into from
Feb 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions addons/main/script_macros_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1812,9 +1812,9 @@ Macro: IS_ADMIN_LOGGED

/* -------------------------------------------
Macro: FILE_EXISTS
Check if a file exists on machines with interface
Check if a file exists

Reports "false" if the file does not exist and throws an error in RPT.
Reports "false" if the file does not exist.

Parameters:
FILE - Path to the file
Expand All @@ -1828,17 +1828,4 @@ Macro: FILE_EXISTS
Author:
commy2
------------------------------------------- */
#define FILE_EXISTS(FILE) (call {\
private _return = false;\
isNil {\
private _control = (uiNamespace getVariable ["RscDisplayMain", displayNull]) ctrlCreate ["RscHTML", -1];\
if (isNull _control) then {\
_return = loadFile (FILE) != "";\
} else {\
_control htmlLoad (FILE);\
_return = ctrlHTMLLoaded _control;\
ctrlDelete _control;\
};\
};\
_return\
})
#define FILE_EXISTS(FILE) (fileExists (FILE))