Hello,
Did you set the PathDelim and AllowDirectorySeparators variables correctly ?
By default they are set to URL separators:
PathDelim : Char = '/';
AllowDirectorySeparators : Set of Char = ['/'];
If you want to use the native windows characters you must set them in the startup of your program, like this:
PathDelim : Char = '\';
AllowDirectorySeparators : Set of Char = ['/','\'];
Otherwise it will not work.
Your proposed solution is wrong for unix or the web (URL), because you hardcode \ which is correct only on windows.
The nodejsapp unit could probably detect the correct setting and set the variables automatically.
Michael.
warleyalex wrote 44 lines
var
fullFileName : string;
begin
// Set up a full file name with drive and path
fullFileName := 'C:\Program Files\Borland\Delphi7\Projects\Unit1.dcu';
// 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));
console.log(ExtractFileName_(fullFileName));
console.log(ExtractFileNameWithoutExt_(fullFileName));
(* outputs this:
Drive = C: // ---> OK
Dir = C: // ----> should be C:\Program
Files\Borland\Delphi7\Projects
Path = C: //----> should be C:\Program
Files\Borland\Delphi7\Projects\
Name = \Program Files\Borland\Delphi7\Projects\Unit1.dcu // --->
should be Unit1.dcu
Ext = .dcu // ----> OK
Unit1.dcu // ---> OK
Unit1 // ---> OK
*)
--
Sent from:
http://pas2js.38893.n8.nabble.com/
_______________________________________________
Pas2js maillist -
https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js