Variation to access files/folder path from Mac and Windows

Hello Knime,

I have knime application installed on MAC laptop(local machine) from where I access a file from my shared drive(windows).

I can successfully access a file from MAC(local machine for development) where the file location path comes as,

/Volumes/share/Sports/Executed_Workflow_Check/SB-00-File_Clean_Up.csv

If you see the above path it is with forward slash / as I am accessing from MAC.

I have a situation where I have to deploy my workflow on windows( production machine) where the above path with forward slash / is not understood. To fix this I have to go inside the windows (production machine) and manually changes the path to backward \ which is understood by windows machine.

This is sometimes irritating for me to go and changes the slash to backward in my production machine.

Is there any work around for this to stop me to change the slashes direction ?
Or do I need to have same type of machine(MAC) on my shared drive, local and production ?

Thank you
Srinivas.

Hi @ShinagdeS,

normally I get the separator through a java snippet and the java
File.separator

String filepath = File.separator + “folderA”+ File.separator + “filename.txt”

separator: Platform dependent default name-separator character as String. For windows, it’s ‘\’ and for unix it’s ‘/’

Then I set the filepath accordingly.

In some cases I use a switch which sets different paths depending on if a file can be found (e.g. if C/temp can be found then use that else use \usr\temp…)

However both make it hard if the workflow contains many different locations (even with template metanodes)

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.