[Mono-dev] R: System.IO.Path: inconsistent paths from Windowsclients

subscription.sapi subscription.sapi at apsystems.it
Mon Jun 26 12:09:08 EDT 2006


Yes. We'are porting a WEB application from windows to linux+mono.

Yes, on linux the directory separator is "/", but if a Windows client is connected on web page on linux+mono+apache server, and a web page allow for file uploads: probably mono server should be platform independent or we should distinguish at "application level" between web Linux clients or web Microsoft clients.

 

 

A test case listing is below (server side code on a web application):

 

string FileName=myFile.PostedFile.FileName;

Label1.Text= "dir sep: "+Path.DirectorySeparatorChar+"<br>";

Label1.Text+= "pat sep: "+Path.PathSeparator+"<br>";

// Prendo solo il nome del file senza il percorso.

Label1.Text+= "0"+myFile.PostedFile.FileName+"<br>";

Label1.Text+= "1"+Path.GetFileName(myFile.PostedFile.FileName)+"<br>";

Label1.Text+= "2"+Path.GetDirectoryName(myFile.PostedFile.FileName)+"<br>";

Label1.Text+= "3"+Path.GetFileNameWithoutExtension(myFile.PostedFile.FileName)+"<br>";

Label1.Text+= "4"+Path.GetPathRoot(myFile.PostedFile.FileName)+"<br>";

 

 

Roberto Cazzato

A.P.Systems srl

via Milano 89/91, ang. via Cimarosa

20013 Magenta (MI)

Tel: +39 02 972261

Fax: +39 02 97226339

Mobile: +39 348 2200850

E-Mail: roberto.cazzato at apsystems.it

http://www.apsystems.it

 

-----Messaggio originale-----
Da: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-bounces at lists.ximian.com] Per conto di Robert Jordan
Inviato: lunedì 26 giugno 2006 17.42
A: mono-devel-list at lists.ximian.com
Oggetto: Re: [Mono-dev] System.IO.Path: inconsistent paths from Windowsclients

 

subscription.sapi wrote:

> I've different behavior in ms.net framework and mono framework when I

> use methods in "System.IO.Path" class.

> 

> Test Case Description:

 

Next time please post the source code of your test case

along with a system description (Mono version, OS, etc.).

 

> MONO:

> 

> Input path: D:\R&D\doc\jd\StandardJD.doc

> 

> Output path: 

> 

> Path.GetFileName

> D:\R&D\doc\jd\StandardJD.doc

> Path.GetDirectoryName                       

> Path.GetFileNameWithoutExtension      D:\R&D\doc\jd\StandardJD

> Path.GetPathRoot                               

 

I cannot reproduce this with Mono 1.1.15 under Windows,

so you're probably testing under Linux.

 

The directory separator under Linux is '/' or

Path.DirectorySeparatorChar, so you have to flip the '\'.

 

Robert

 

_______________________________________________

Mono-devel-list mailing list

Mono-devel-list at lists.ximian.com

http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060626/f665df59/attachment.html 


More information about the Mono-devel-list mailing list