2015 Oct 19 4:02 AM
Hi SAP experts,
I would like to ask for an advice on using DIRECTORY EXISTS static method from CL_GUI_FRONTEND_SERVICE class.
I am trying to create a generic file validator that iterates to all directories given the path from user's file system. However, i am concerned with the user's OS, what if the user is using a different OS such as Linux or Solaris? if i am not mistaken, i believe they use slash (/) instead of backslash(\).
Will this be able to get accommodated by DIRECTORY EXISTS?
Thanks and warmest regards,
Ryann
2015 Oct 20 2:01 PM
Hi Ryann,
You can use CL_GUI_FRONTEND_SERVICES=>GET_FILE_SEPARATOR to get the separator as per the Operating system.
Thanks,
Juwin
2015 Oct 19 6:37 AM
Hi,
I am afraid you will have to use slashes as per the OS.
Windows uses '\' while all Linux versions use '/' for directory access.
2015 Oct 20 2:01 PM
Hi Ryann,
You can use CL_GUI_FRONTEND_SERVICES=>GET_FILE_SEPARATOR to get the separator as per the Operating system.
Thanks,
Juwin
2015 Oct 21 4:20 AM
Hi Juwin,
Thanks, this is a possibility. I tried it on a test program and it returns the correct separator under my OS.
Also inside the code method GET_FILE_SEPARATOR, are the variables: P_SEPARATOR_WINDOWS 'which is initialized value at '\'
P_SEPARATOR_UNIX which is initialized value at '/'
However, there's one thing i want to be sure of, does this act like the SY-OPSYS? where it checks the OS of the application server instead of where the SAP GUI is being run (machine of the user)?
Regards,
Ryann
2015 Oct 21 11:43 AM
Yes, it is supposed to. But I haven't got a chance to try this in a non-windows machine.
Thanks
2015 Oct 28 6:00 AM