cxShellTreeView component get the path - delphi

i'm trying to get full path of the selected Folder. Only thing i was able to find is this
cxShellTreeView2.Folders[Index].PathName, but i don't know how to get this Index.

Is it the path of the map?
self.cxShellTreeView2.Path;
or
self.cxShellTreeView2.AbsolutePath;
Description TcxCustomShellTreeView.AbsolutePath
Use the AbsolutePath property to specify the path to the required shell node. Folder path can be specified in two ways:
as a full path, including all sequence of folders, required for accessing the required shell node from the shell root.
Description TcxCustomShellTreeView.Path
Use the Path property to specify the path to the current shell item. Folder path can be specified in two ways:
as a full path, including all sequence of folders, required for accessing the required shell item from the shell root.

The full path of a selected folder is returned by cxShellTreeView1.AbsolutePath.

Related

What is called '../' in a relative file/folder path?

In a file path, the set of "words" or folder names required to specify a specific file in a hierarchy of directories is called the path to the file, which is called path name. Path name can be either absolute or relative. In relative form, a sort of patterns like "./", "../", "../../", ... can be used to show the file/folder depth corresponding to the project base folder.
I know what they do or implying by behavior, but what are they called? Do they have a specific name? For example, what is called "../" or "..\" in a file system?
Briefly, it is called levelup notion.
Let's start with defining path:
A path is a slash-separated list of directory names followed by either
a directory name or a file name. A directory is the same as a folder.
Then, we look at types of paths: Absolute and relative paths!
An absolute, or full, path begins with a drive letter, whereas a relative path refers to a location that is relative to a current directory.
In relative paths we may use dot and double-dot symbols. A dot here means the current directory itself. And the double-dot notation, which is called level-up, is used for moving up in the hierarchy.
Now to change the directory using the dot notion we do as follows:
A single dot represents the current directory itself. for example:
in a command line interface (e.g. PowerShell):
cd . will not change the directory as itself point to the current directory.
To change the directory using the level-up notion we do as follows:
each double-dot notions takes you one level up, meaning one folder closer to the base drive or root folder in the hierarchy.
Look at the example below for different cases of using levelup notions:

Is there a plugin to get Folder path as parameter in Jenkins?

I wanted to allow users to select a folder path as a parameter and get the entire folder path as the parameter value. Is there any plugin for this purpose.
I have explored the File Parameter, this allows to select a file path and gives only the file name as output and not the path.
I also explored the File systems object parameter list, this is used to list the folders inside a file as choices.
Have you tried using a String parameter for it? I have several pipelines where I have paths defined as string parameters for use in shell scripts.
Are you sure Filesystem List Parameter can't be conigured to meet your needs?
I believe Extended Choice Parameter should allow you to do this. You'd have write as custom groovy, which could be tricky or take time to load.
You could maybe (request) enhance the Filesystem List Parameter plugin

MATLAB: Set current folder to script's locaton

I have a handful of scripts and data in different folders and I use addpath and relative paths very often. My problem is, this only works if my current folder is where the script that I execute is located. For example, if I execute script A which adds path X and later execute script B which lies in path X, Matlab doesn't automatically change the folder and relative paths specified in script B don't work anymore.
Is there a way to automatically set my current folder to the location of the script I'm executing?
/edit: I should note that I use these scripts on different computers with different drive names, so using absolute paths probably won't help.
Put the following line in the script, it would set the current directory = script directory
cd(fileparts(mfilename('fullpath')))

Why does the DOS "path" command repeat entries?

(WinXP Home SP2)
path command output from CLI
Path variable value from My Computer > Properties > Advanced > Environment Variables
There is nothing magical about the PATH environment variable that prevents duplicate entries.
Typically the individual paths are added to PATH via some type of installer, though they can also be added manually. It is the job of the installer to make sure duplicates are not entered. Some installers are lazy and don't bother to check to see if a given path already exists prior to insertion.
The initial value for PATH is built by combining the System and User environment settings from the registry.
Often times a batch process will attempt to augment the path with an additional entry, if and only if it does not already exist. How to check if directory exists in %PATH%? is a popular SO batch file question.
Probably the PATH variable itself is contained in the PATH

Relative path of a given file from a service application in Delphi

I have a problem loading a file, as I'm passing a relative path to the function FileExists(Filename: String) and it's returning false, that is, it does not find the file in the directory that I pass.
I have a file named Template.html in the D:\Programming\Delphi\Projects\SendMail directory, and a service written in Delphi whose .EXE is in the D:\Programming\Delphi\Automation directory. I am passing the relative path: .\..\Projects\SendMail\Template.html to FileExists(), but it's returning that the file does not exist.
I think that has something to do with the relative path of a service and the relative path of the application being different. Can anybody help me with this?
As lorenzog said, try specifying the full path.
You can also try to set the currentdir to your likings.
//sets currentdir to your application.exe dir
SetCurrentDir(ExtractFileDir(ParamStr(0)));
You assume that the current directory of the service is the directory the executable is stored in. Call GetCurrentDir to find out the current directory.
My experience has been that services start with a working folder of %SystemRoot%\System32 no matter where the actual executable is located.
The way that I have got around this limitation is to write a registry key during installation of the service (e.g. HKLM\SOFTWARE\MyCompany\MyApp\INSTALL_PATH) that points to what I would like the working folder to be. Then when the service starts, it grabs the data from the registry and uses that value as the base when creating paths to files.

Resources