DOS paths
-
Is it just me

On a PC...
Sketchup.find_support_file('Plugins')
v7 returns
C:\Program Files\Google\Google SketchUp 7\Plugins
v8 returns
C:/PROGRA~1/Google/GOOGLE~3/plugins
OR
C:/Program Files/Google/Google SketchUp 8/Plugins
and
File.dirname(__FILE__)
is similar...
There seems to be no reason it changes...This DOS
path now seems useless for compiling URL paths etc 
Any clues on how to get long-paths back ? -
Answering my own question
require 'win32ole' def self.get_long_filename(shortpath, fso = WIN32OLE.new("Scripting.FileSystemObject")) path = case when fso.FolderExists(shortpath) fso.GetFolder(fso.GetAbsolutePathName(shortpath)) when fso.FileExists(shortpath) fso.GetFile(fso.GetAbsolutePathName(shortpath)) else return shortpath end parts = path.Path.split("\\") working = fso.GetDrive(parts.shift).RootFolder longpath = working.Path parts.each{|part| temppath = fso.BuildPath(longpath, part) working = fso.GetFolder(longpath) if fso.FolderExists(temppath) working.SubFolders.each do |sub| longpath = fso.BuildPath(longpath, sub.Name) if part== sub.ShortName || part == sub.Name end elsif fso.FileExists(temppath) working.Files.each{|sub| longpath = fso.BuildPath(longpath, sub.Name) if part== sub.ShortName || part == sub.Name } end } return longpath end -
Might be a Vista thing.
On my XP, SU v7 and v8, both:
Sketchup.find_support_file('Plugins') %(#800080)[>> C:/Program Files/Google/Google SketchUp 8/Plugins]I do not get backslashes nor contracted dir names.
ADD: However I run v7 with a copy of the ruby dll from v8. (Ruby v1.8.6-p287)
-
I cannot remember getting those types of paths from SketcHup....
-
Are you calling some utility using
systemor ` ```? I've seen short names in paths like this sometimes. -
Most of the time I get also get 'full-paths' returned.
Just occasionally they revert to the short DOS form.
This can occur in the same model with the same 'other plugins' loading and the same paths used...
It's not a big issue - often the short-path form works well anyway... and the posted code does return the full-path from the short-form if it's needed...
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement