So it is Delphi example.
You can use property Directory (instead of LongName) and DirectorySeparator (instead of '\', beacause in Unix it is '/')
if DirectoryEdit1.Text [Length (DirectoryEdit1.Text)] <> DirectorySeparator then
OutputFileName:= DirectoryEdit1.Directory + = DirectorySeparator+ ChangeFileExt (ExtractFileName (FileNameEdit1.filename). 'mp3')
else
OutputFileName:= DirectoryEdit1.Directory + ChangeFileExt (ExtractFileName (FileNameEdit1.filename). 'mp3');
You should also check if the directory exists using function:
if DirectoryExists(DirectoryEdit1.Directory)=true then ....
or you can make
DirectoryEdit1.ReadOnly:=true;
(it will force users to select the path in dialog and not edit it directly)