Thanks for your reply.
Let me explain the scenario in which i want to get the file seperator.

I am using FileUploadWidget to upload a file.
After uploading file I am adding the uploaded filename in a ListBox to
display the uploaded filename to the user.
>From server side I am returning the complete path of the file where I
created uploaded file on the server. Code is given below :-

response.setContentType("text/html");
String path = filePath+System.getProperty("file.separator")+fileName;
response.getWriter().write(path);

On client side
public void onSubmitComplete(FormSubmitCompleteEvent event)
    {
       //--- Get the complete path of uploaded file ---
        String fileUrl= event.getResults();
        int idx = fileUrl.lastIndexOf("\\");
        String fileName = null;

        if (idx != -1)
        {
                        //--- Get the filename from the url. ---
                        fileName = fileUrl.substring(idx + 1);
                        //--- listAttachments is a ListBox in which I
am adding filename. ---
                        this.listAttachments.addItem(fileName,
fileUrl);
        }

    }


This code is working fine on Windows Operating System but not working
on Linux.
Because Windows using "\" as a fileseperator and Linux using "/" as
fileseperator.

So what I will use to get the file seperator in the code given below,
which will work on both Windows and Linux.
  int idx = fileUrl.lastIndexOf("\\");

Is there any substitue of System.getProperty("file.separator") which I
will use on client side to get the seperator, which will work on cross
platform ?


On Jan 30, 3:16 am, danox <[email protected]> wrote:
> Which file separator do you want to get?
>
> If it is the client file separator, the only way I could think would
> be to run a trusted java applet in the client and use javascript to
> invoke a call to System.getProperty(). This would involve the user
> having to agree to let the applet run and so on.
>
> If you wanted the file separator on the server, you could always make
> an Async call to a service that called System.getProperty();
>
> I can't help feeling, though,  that the fact that you want to get the
> file separator in the client would suggest that what you are trying to
> do with it isn't going to work.
>
> On Jan 30, 4:34 am, Rinku <[email protected]> wrote:
>
> > How to get file seperator in gwt to because System.getProperty
> > ("file.separator") is not working on client side ?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to