sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    Pack Up Multiple Files into a Single .rb File?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 4 Posters 478 Views
    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.
    • J Offline
      Jim
      last edited by Jim

      I may have asked this before, but isn't it possible (and not even that hard) to package-up all of a plugin's file into a single .rb which would self-extract itself to the Plugins folder?

      I know Unix has had command-line utilities to do this type of thing forever (shar, for example.)

      Hi

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

        ~
        WinZip could do this since forever. It creates a self-extracting exe, that (dependant on the archiver's choice,) can prompt the enduser, where he/she wants to extract the files to.

        7zip can also do a similar job. See the 7z help file, "Command Line Version" section, "Switches" subsection, -sfx (Create SFX archive) switch.

        There used to be a company called PKware that made archivers as well.
        ~
        *PS: WinZip is not the built-in zip folder feature in Windows XP+, it's the application WinZip.

        I'm not here much anymore.

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

          BTW.. 7zip is a plug-in capable app. There may be plugins out there that simplfy creating self-extracting archives.
          .
          EDIT: Oh.. I just tried creating a self-extracting archive using the checkbox in 7zip's create archive dialog, and it wrote out a exe file.
          ❗

          I'm not here much anymore.

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

            I found the 7z's sxe documentation lacking, and it isn't cross-platform, is it?

            Hi

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

              Should be able to. There is a keyword in Ruby you can use to indicate the end of the file - as far as the ruby processor is concerned.

              So stuff the files you need after that point and have the script unpack it.
              Just need to find out how you indicate the start and end of the embedded files.

              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

                It seems like it would be straight forward. I think pack and unpack can do base64 encoding/decoding, and so just encode every file, binary or not, to make it simpler. I'm just being lazy. πŸ˜„

                Hi

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

                  Yea, base64 encoding would be doing it pretty much like you do with emails - using a unique indentifier to indicate the file splits.

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

                  1 Reply Last reply Reply Quote 0
                  • tbdT Offline
                    tbd
                    last edited by

                    I did something like that in timetrack.rb - here is the uncompress part

                    
                    
                     zap_files = <<EOL
                    {"tt_stop_l.png"=>"... removed ...", "tt_go_s.png"=>"... removed ..."}
                    EOL
                    
                      if not FileTest.exists?("tt_stop_l.png")
                        eval(zap_files).each_pair do |x,y|
                          File.open(File.join(Sketchup.find_support_file("Plugins"), x),"wb") do |f|
                              f.write y.unpack("m")
                          end
                        end
                      end
                    
                    
                    

                    SketchUp Ruby Consultant | Podium 1.x developer
                    http://plugins.ro

                    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