I have a rails application that contains a simple piece of code to create a directory if it does not exist.
FileUtils.mkpath(self.webapp_dir) unless File.exists?(self.webapp_dir)
This behaves as expected on my development workstation (OS X 10.9), but I get errors when deploying to other environments (Red Hat 4.4.6-3).
In my rails console, I ran the following:
FileUtils.mkpath('/path/to/my/project/public/web_apps/1')
Please note that the first time there is "public / web_apps /", but "1" does not work. It succeeds. I can start it again with all the existing circuit, and every time it is deleted without errors.
Now I am trying to run the same code in the rails console in a production environment. Again, "public / web_apps /" already exists, but "1" does not. In this case, I get an error.
FileUtils.mkpath('/path/to/my/project/public/web_apps/1')
--> Errno::EEXIST: File exists - /path/to/my/project/public/web_apps
- , - ? , , , , mkpath.
, , (, File.size , ). SO, , , , , . , ?