Mac Help Needed
-
I'm trying to write a bit of code that let's the developer access WebDialog's HTML files in locations of your own choice. I need to know what happens as you back up toward and at your root directory.
If someone could try this:
In the Ruby Console ask
Dir::pwd
(*nix for Print Working Directory). That should report something like/foo/bar/moo/baz
. Then back up a directory withDir::chdir( '..' )
and askDir::pwd
again. (You can use the up arrow in the RC to save retyping.)It should report
/foo/bar/moo
. Done again you should get/foo/bar
then/foo
, then/
and then? Do you get an error or do you just get/
again? Or do you get an error before you get this far?Thanks ever so much!
-
Hi Martin, completely out of my depth here, but I am interested in code...
all i get after typing
Dir::pwd
is;
/
That's it!
-
do I get a stroke, because the root directory is disabled by default on a Mac?
-
@tfdesign said:
all i get after typing
Dir::pwd
is;
/
That's it!
And if you then
Dir::chmod( '..' )
and thenDir::pwd
do you still look at the single forward slash (root)? -
Martin, yes.
> Dir;;chmod( '..' ) Error; #<NoMethodError; undefined method `chmod' for Dir;Class> (eval);16 > Dir;;pwd /
-
@tfdesign said:
Martin, yes.
> Dir;;chmod( '..' ) > Error; #<NoMethodError; undefined method `chmod' for Dir;Class> > (eval);16 > > Dir;;pwd > / >
Stupid me. That should be
Dir::chdir( '..' )
. Glad you showed the error message. -
Martin,
I tried that, and the ruby console returned;
0
Nought. (or zero)
-
The default working directory for Ruby inside Sketchup is root.
You could start with ENV['HOME'] to get to a more reasonable choice for user files.
-
Thanks, guys.
I've looked harder and seen that there is NO Mac issue. It's a Windows-only problem.
http://forums.sketchucation.com/viewtopic.php?f=180&t=26040&p=224362#p224362
I'll post my little movie later today and it just might run on Macs. (Crossing fingers, knocking wood, rubbing rabbit's foot.)
-
@martinrinehart said:
I've looked harder and seen that there is NO Mac issue. It's a Windows-only problem.
That's heartening to hear! The amount of times I've heard windows developers moan that there is a fault, and it is Apple's fault!
Advertisement