mkdir() is not working on Mac OSX

Questions and answers on developing, deploying and using plugins and JavaBeans

mkdir() is not working on Mac OSX

Postby chaitanyas » Wed Aug 26, 2015 8:24 am

Hi Everyone,


I have an issue with mkdirs() on Mac OSX, it's throwing exception like, "No such file or Directory" and it's working fine in Windows. It seems, file permissions issue then I have assigned "Read & write" permissions for "everyone" then I can able to create folders from Servoy but I don't want to provide "read & write" permission for everyone, which leads to security issues.

Is there any alternative for this ?, if so, please share to me.


Servoy Version : 7.4.2
Java : 7
Operating System : Mac


Thanks
Chaitanya S
chaitanyas
 
Posts: 101
Joined: Tue Jul 26, 2011 8:28 am

Re: mkdir() is not working on Mac OSX

Postby Harjo » Wed Aug 26, 2015 9:08 am

You have to assign the permissions, to the user, which Servoy (or client) is running under!
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: mkdir() is not working on Mac OSX

Postby chaitanyas » Wed Aug 26, 2015 11:17 am

Hi Harjo,

Thanks for the reply, The user who is running Servoy application is a Administrator and has permissions to "read & write", though it's throwing the exception "No such file or directory". Do I need to create a new user for Servoy Application ?


Thanks
Chaitanya S
chaitanyas
 
Posts: 101
Joined: Tue Jul 26, 2011 8:28 am

Re: mkdir() is not working on Mac OSX

Postby chaitanyas » Thu Aug 27, 2015 7:33 am

Hi All,

Anyone having idea about this please ?


Thanks
Chaitanya S
chaitanyas
 
Posts: 101
Joined: Tue Jul 26, 2011 8:28 am

Re: mkdir() is not working on Mac OSX

Postby Harjo » Thu Aug 27, 2015 10:26 am

Can you explain a little bit more, your situation?? Is this a real smart-client? or a developer?
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: mkdir() is not working on Mac OSX

Postby chaitanyas » Thu Aug 27, 2015 5:08 pm

Hi Harjo,

I need to create a folder structure like, /A/B/C on Mac machine and I used below code for that

var fs = plugins.file.convertToJSFile("/A/B/C ");
fs.mkdirs()

but it throws an exception like, "No Such file or directory" (Exception happened in both Servoy developer and Smart client). I observed, there is a "Read only" permission for "everyone" user then I have modified the permission to "Read & Write" then I can able to create folder structure without any exception. Hope it is clear.

Is there any other solution for this ?
chaitanyas
 
Posts: 101
Joined: Tue Jul 26, 2011 8:28 am

Re: mkdir() is not working on Mac OSX

Postby lwjwillemsen » Thu Aug 27, 2015 6:01 pm

Did you try : plugins.file.createFolder() ?
Lambert Willemsen
Vision Development BV
lwjwillemsen
 
Posts: 680
Joined: Sat Mar 14, 2009 5:39 pm
Location: The Netherlands

Re: mkdir() is not working on Mac OSX

Postby mboegem » Thu Aug 27, 2015 6:13 pm

Why are you trying to write in a Mac-folder having read-only set for everyone in the first place?
Mac normally has a reason to have this set like this.
Can't you use a parent folder on the Mac that has sufficient privileges, as you have on the Windows machine (where you obviously not care about security?!) ?

Maybe if you explain a little bit more about the reasons/goal of this, people can think of a solution for you.
Currently you're asking for a solution to something that can't be solved other than changing privileges, which you don't like.
That makes it hard to help out...
Marc Boegem
Solutiative / JBS Group, Partner
Servoy Specialist
• Servoy Certified Developer
• Servoy Valued Professional
• Freelance Developer

Image
User avatar
mboegem
 
Posts: 1757
Joined: Sun Oct 14, 2007 1:34 pm
Location: Amsterdam

Re: mkdir() is not working on Mac OSX

Postby swingman » Fri Aug 28, 2015 8:33 am

Code: Select all
plugins.file.convertToJSFile("/A/B/C ");


Not sure how .convertToJSFile treats the path you give it.
In unix, a '/' will take you to the root of the computer, where you certainly will not have access to write folders.
Could this be the reason it fails? (There is also a trailing space....)
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: mkdir() is not working on Mac OSX

Postby chaitanyas » Fri Aug 28, 2015 12:08 pm

Hi Swingman,

Yes, I want to create a folders inside a root folder ("/") on Mac OSX , for example, "/A/B/C" and I understand that it's not possible. Thanks anyway for your help.


Thanks
Chaitanya S
chaitanyas
 
Posts: 101
Joined: Tue Jul 26, 2011 8:28 am

Re: mkdir() is not working on Mac OSX

Postby swingman » Fri Aug 28, 2015 6:47 pm

Not sure why you would want to create folders outside of the users home folder. They will not be accessible to the user.

The file plugin has a function get you the path of the users home folder. Here you can create folders - no problem. You may also be able to create folders inside the user called 'Shared'.

You can also create folders for files shared by all our Servoy users inside the web root of the Servoy server. You can stream files to and from this location. A headless client running on the server can access this location directly.


Hope this helps,
Christian Batchelor
Certified Servoy Developer
Batchelor Associates Ltd, London, UK
http://www.batchelorassociates.co.uk

http://www.postgresql.org - The world's most advanced open source database.
User avatar
swingman
 
Posts: 1474
Joined: Wed Oct 01, 2003 10:20 am
Location: London

Re: mkdir() is not working on Mac OSX

Postby chaitanyas » Wed Sep 09, 2015 2:00 pm

Hi Swingman,

Thanks for your suggestion, creating folders at Home directory is working fine without any issue.

Thanks
Chaitanya S
chaitanyas
 
Posts: 101
Joined: Tue Jul 26, 2011 8:28 am


Return to Plugins and Beans

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron