Project.ConfigPath Property

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

This property returns the path to the folder that contains configuration files of the current TestComplete project.

Declaration

Project.ConfigPath

Read-Only Property String

Applies To

The property is applied to the following object:

Property Value

A string that denotes the path to the folder that holds configuration files of the current project in TestComplete.

Example

The following example demonstrates how to obtain the path to the folder where the current project stores its configuration files and how to check whether the .tcLS file that holds the project settings resides in that folder.

JavaScript, JScript

function ProjectSample()
{
  var ConfigPath, ConfigFiles, aFile;

  // Obtains the path to the folder that stores the project configuration files
  ConfigPath = Project.ConfigPath;
  // Searches for the .tcLS files in the folder
  ConfigFiles = aqFileSystem.FindFiles(ConfigPath, "*.tcLS");
  if (ConfigFiles.Count > 0)
  {
    while (ConfigFiles.HasNext())
    {
      aFile = ConfigFiles.Next();
      Log.Message(aFile.Name + " file is located in " + ConfigPath);
    }
  }
  else
    Log.Message("No .tcLS files were found");
}

Python

def ProjectSample():
  # Obtains the path to the folder that stores the project configuration files
  ConfigPath = Project.ConfigPath
  # Searches for the .tcLS files in the folder
  ConfigFiles = aqFileSystem.FindFiles(ConfigPath, "*.tcLS")
  if ConfigFiles.Count > 0:
    while ConfigFiles.HasNext():
      aFile = ConfigFiles.Next();
      Log.Message(aFile.Name + " file is located in " + ConfigPath)
  else:
    Log.Message("No .tcLS files were found")

VBScript

Sub ProjectSample

  Dim ConfigPath, ConfigFiles, aFile

  ' Obtains the path to the folder that stores the project configuration files
  ConfigPath = Project.ConfigPath
  ' Searches for the .tcLS files in the folder
  Set ConfigFiles = aqFileSystem.FindFiles(ConfigPath, "*.tcLS")
  If ConfigFiles.Count > 0 Then
    While ConfigFiles.HasNext
      Set aFile = ConfigFiles.Next
      Log.Message aFile.Name & " file is located in " & ConfigPath
    Wend
  Else
    Log.Message "No .tcLS files were found"
  End If

End Sub

DelphiScript

procedure ProjectSample();
var ConfigPath, ConfigFiles, aFile;

begin
  // Obtains the path to the folder that stores the project configuration files
  ConfigPath := Project.ConfigPath;
  // Searches for the .tcLS files in the folder
  ConfigFiles := aqFileSystem.FindFiles(ConfigPath, '*.tcLS');
  if ConfigFiles.Count > 0 then
  begin
    while ConfigFiles.HasNext do
    begin
      aFile := ConfigFiles.Next;
      Log.Message(aFile.Name + ' file is located in ' + ConfigPath);
    end;
  end
  else
    Log.Message('No .tcLS files were found');
end;

C++Script, C#Script

function ProjectSample()
{
  var ConfigPath, ConfigFiles, aFile;

  // Obtains the path to the folder that stores the project configuration files
  ConfigPath = Project["ConfigPath"];
  // Searches for the .tcLS files in the folder
  ConfigFiles = aqFileSystem["FindFiles"](ConfigPath, "*.tcLS");
  if (ConfigFiles.Count > 0)
  {
    while (ConfigFiles["HasNext"]())
    {
      aFile = ConfigFiles["Next"]();
      Log["Message"](aFile["Name"] + " file is located in " + ConfigPath);
    }
  }
  else
    Log["Message"]("No .tcLS files were found");
}

See Also

Project.FileName
Project.Path
ProjectSuite.ConfigPath
ProjectSuite.Path
ProjectSuite.FileName

Highlight search results