From Clomosy Docs

No edit summary
No edit summary
Line 14: Line 14:


'''Example:'''
'''Example:'''
:''Base Syntax''
  var
    strList:TclStringList;
    fileStr:String;
  begin
    strList := Clomosy.StringListNew;
    fileStr := clPathCombine('File.Txt',Clomosy.AppFilesPath);
    ShowMessage(fileStr);
 
    If clFileExists(fileStr,Clomosy.AppFilesPath) then
    begin
      strList.Add('New Line 1');
      strList.SaveToFile(fileStr,0);
    end else
    begin
      strList.SaveToFile(fileStr,0);
    end
  end;


'''var'''
:''TRObject Syntax''
  strList:TclStringList;
  var
  MyFileStr:String;
    strList:TclStringList;
'''Begin'''
    fileStr:String;
  strList := Clomosy.StringListNew;
  {
  MyFileStr := ''clPathCombine''('MyFile.Txt',Clomosy.AppFilesPath);
    strList = Clomosy.StringListNew;
  //ShowMessage(MyFileStr);
    fileStr = clPathCombine('File.Txt',Clomosy.AppFilesPath);
    ShowMessage(fileStr);
  If clFileExists(MyFileStr,'C:\Clomosy') Then
 
  strList.LoadFromFile(MyFileStr,0);
    If clFileExists(fileStr,Clomosy.AppFilesPath)  
  strList.Add('New Line');
    {
  strList.SaveToFile(MyFileStr,0);
      strList.Add('New Line 1');
'''End;'''
      strList.SaveToFile(fileStr,0);
    } else
    {
      strList.SaveToFile(fileStr,0);
    }
  }


= See Also =
= See Also =
* [[Controls| Controls]]
* [[Controls| Controls]]

Revision as of 10:37, 24 January 2024

clPathCombine is a function that is part of the Clomosy library. This function returns a string data by concatenating the file path and file name.

The general usage is as follows:

clPathCombine(FileNameString:WideString; CombinePathString:String);

FileNameString : Searched file name.

CombinePathString : The file path to merge.

For instance:

CombinedPath := clPathCombine('File.txt','C:\Document');
 // Now CombinedPath will be 'C:\Document\File.txt'.

Example:

Base Syntax
 var
   strList:TclStringList;
   fileStr:String;
 begin
   strList := Clomosy.StringListNew;
   fileStr := clPathCombine('File.Txt',Clomosy.AppFilesPath);
   ShowMessage(fileStr);
 
   If clFileExists(fileStr,Clomosy.AppFilesPath) then
   begin
     strList.Add('New Line 1');
     strList.SaveToFile(fileStr,0);
   end else
   begin
     strList.SaveToFile(fileStr,0);
   end
 end;
TRObject Syntax
 var
   strList:TclStringList;
   fileStr:String;
 {
   strList = Clomosy.StringListNew;
   fileStr = clPathCombine('File.Txt',Clomosy.AppFilesPath);
   ShowMessage(fileStr);
 
   If clFileExists(fileStr,Clomosy.AppFilesPath) 
   {
     strList.Add('New Line 1');
     strList.SaveToFile(fileStr,0);
   } else
   {
     strList.SaveToFile(fileStr,0);
   }
 }

See Also