Extracts all of the parts of a full file name



Hi there. I'd like to use, the ExtractFileName function which extracts from FullFileName the file name substring and use native windows characters. First of all, if you need to use some of these functions, e.g. ExtractFileDrive, ExtractFileDir, ExtractFilePath, ExtractFileName or ExtractFileExt functions in your pas2js programs - you must set some key variables correctly in your pas2js startup program, otherwise, those functions won't work as expected!
Pas2JS pascal source code
var fullFileName : String = 'C:\Program Files\Borland\Delphi7\Projects\Unit1.dcu'; begin // Set the variables correctly in the program startup, otherwise it will not work. PathDelim : Char = '\'; AllowDirectorySeparators := ['\', '/']; // Show the component parts of this full name console.log('Drive = '+ExtractFileDrive (fullFileName)); console.log('Dir = '+ExtractFileDir (fullFileName)); console.log('Path = '+ExtractFilePath (fullFileName)); console.log('Name = '+extractfilename (fullFileName)); console.log('Ext = '+ExtractFileExt (fullFileName)); end; (* ----> output <------ Drive = C: Dir = C:\Program Files\Borland\Delphi7\Projects Path = C:\Program Files\Borland\Delphi7\Projects\ Name = Unit1.dcu Ext = .dcu ------------------------ *)