From Clomosy Docs

No edit summary
No edit summary
Line 1: Line 1:
clFileExists is part of the Clomosy library and is a function that checks for the existence of the specified file. Returns True if the specified file exists, False otherwise.
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function clFileExists(const FileName: string; CombinePathString:String): Boolean;
</div>


The general usage is as follows:
It is a function that is part of the Clomosy platform and checks for the existence of a specified file. If the specified file exists, it returns True; if it does not exist, it returns False.<br>
clFileExists(FileNameString:WideString; CombinePathString:String);
The function takes two parameters: the first parameter is the name of the file being searched for, and the second parameter is the file path written as a string.<br>


<span style="color:blue">''FileNameString''</span> : Searched file name.
The general usage is as follows:<br>
<pre>
clFileExists('file.txt','D:\Clomosy'); //clFileExists('ball.png', Clomosy.AppFilesPath)
</pre>


<span style="color:blue">''CombinePathString''</span> : Path to the searched file.
<b>Example</b><br>
 
<b>TRObject Syntax</b><br>
'''Example:'''
<pre>
 
{
:'''TRObject Syntax'''
  if (clFileExists('file.txt',Clomosy.AppFilesPath))
{
  clShowMessage('file exists');
}
Else
  {
  {
  if (clFileExists('file.txt',Clomosy.AppFilesPath))
  clShowMessage('no file');
  {
}
   clShowMessage('file exists');
}
  }
</pre>
  Else  
<b>Base Syntax</b><br>
  {
<pre>
Begin
If clFileExists('file.txt',Clomosy.AppFilesPath) Then
   clShowMessage('file exists')  
Else  
   clShowMessage('no file');
   clShowMessage('no file');
  }
End;
}
</pre>
:'''Base Syntax'''
'''Begin'''
  If clFileExists('file.txt',Clomosy.AppFilesPath) Then
    clShowMessage('file exists')
  Else
    clShowMessage('no file');
'''End;'''


= See Also =
<h2> See Also </h2>
* [[Controls| Controls]]
* [[System_Library#Cl_Utilities_Functions | Cl Utilities Functions]]
* [[File_Handling | File Handling]]

Revision as of 10:27, 23 October 2024

It is a function that is part of the Clomosy platform and checks for the existence of a specified file. If the specified file exists, it returns True; if it does not exist, it returns False.
The function takes two parameters: the first parameter is the name of the file being searched for, and the second parameter is the file path written as a string.

The general usage is as follows:

clFileExists('file.txt','D:\Clomosy'); //clFileExists('ball.png', Clomosy.AppFilesPath)

Example
TRObject Syntax

{
  if (clFileExists('file.txt',Clomosy.AppFilesPath))
 {
  clShowMessage('file exists'); 
 }
 Else 
 {
  clShowMessage('no file');
 }
}

Base Syntax

Begin
 If clFileExists('file.txt',Clomosy.AppFilesPath) Then 
   clShowMessage('file exists') 
 Else 
   clShowMessage('no file');
End;

See Also