sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    DOS paths

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 4 Posters 202 Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • TIGT Offline
      TIG Moderator
      last edited by

      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 ?

      TIG

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        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
        

        TIG

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          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'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            I cannot remember getting those types of paths from SketcHup....

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • J Offline
              Jim
              last edited by

              Are you calling some utility using system or ` ```? I've seen short names in paths like this sometimes.

              Hi

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                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...

                TIG

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement