Elegant Technologies

  • Meaningful Ventures
  • Simulation & VR/AR/XR
  • Education
  • Mobile Apps
  • Technology & Business
  • Blog
  • About
    • Ongoing Projects
      • Open Kitchens
      • School Twist
    • About Me
    • Contact Me

Technical: Hacking Dashcode to Programmatically Change Deployment Directory

2011-05-26 by JJBigThoughts

I like Apple’s Dashcode more than I should.  It is a powerful Webapp creator that is a bit under-supported.  I don’t think it gets the love, or the hacker support, that it deservers.  So, I find myself trying to make it do stuff it wasn’t originally designed for.  Recently, I’ve been using it to create skins for some non-iOS mobile apps.  As part of a budding workflow, I wrote a script to copy an existing Dashcode project and have it ready for the new project, including published to the right (read – ‘new’) location instead of the old location associated with the previous project.  Well, the challenge, is that Dashcode has the concept of a “Deployment Directory” that should point to my new workspace, not my old workspace.  This article describes how to programmatically change the “Deployment Directory”

So, how can we script a solution for this?

Although Dashcode project looks like a single executable file, it is actually a Finder package with lots of stuff inside.  The trick is looking to see if the deployment path is stored in something we can mess with. It turns out the value is stored in jj.wdgtuser (my user name is jj).  Sweet!

The good news is that is stored in the .xml file – that is also the bad news.  Apple’s xml formats always sort of sucks, so getting to our variable isn’t super easy, unless you think predicate XPATH programming is super easy.

Inside a Dashcode Project

Here are the general steps I used to accomplish scripting the deployment path:

  • Ensure Dashcode is not running
  • Find the current username so you open the right .wdgtuser file.
  • Use XPATH
    • find the dict element whose previous sibling is a key element with a value of ‘DeploymentOptions‘
  • Given the above context, use XPATH to
    • find the string element whose previous sibling is a key element with a value of ‘Path’

 

The hard part here, of course, is finagling XPATH.  Here is the PHP code I used, but you’ll need to modify it for your own means:


$plistPath = baseDir($target)."/skins/{$skinName}.dcproj/jj.wdgtuser";

$xml = simplexml_load_file($plistPath);

$result = $xml->xpath("//dict/dict/string[preceding-sibling::key[1][node()='Path']]/node()");

$result[0][0] = $newDeploymentPath;

 

 

$xml->asXML($plistPath);

Here is a stab at explaining the XPATH above:

 

Hope this helps some other poor soul that wanders into the wilderness of Dashcode hacking.

Filed Under: Technical Tagged With: Dashcode, deployment directory, simple_xml, xpath

Recent Posts

  • Unnamed Strengthen-Democracy Project
  • PowerNap (not) on the Oculus Go
  • Porting PowerNap to Oculus Go
  • So many missing images…
  • I rode a VR bike today

Categories

  • Business of Software (12)
  • Client Projects (1)
  • Content (1)
  • Elegant Labs (4)
  • Mobile (26)
    • Android (5)
    • Blackberry (3)
    • Elegant Torch (1)
    • iOS (23)
      • iPad (14)
      • iPhone & iPod touch (16)
    • Nokia (1)
    • Palm (1)
  • News (6)
  • Personal Technology (1)
  • Platforms (14)
  • Products & Apps (19)
    • Different Proportions (1)
    • Elegant Pythagorean (1)
    • Elegant Quadratic (1)
    • Elegant Word of the Day (1)
    • Elegant Words (2)
    • Lil' Math (1)
    • Meeting Timer (1)
    • Nightlight (1)
    • PowerNap (4)
    • Survey Size (1)
    • Time to Eat (1)
    • Time to Read (1)
    • Wallet Zero (2)
  • Technical (4)
  • Technology Trends & Looming Opportunities (14)
  • Uncategorized (6)
  • VR (3)
  • Wordpress (1)
    • Elegant Tweets for Wordpress (1)

Archives

Copyright © 2026 Elegant Technologies ::

Copyright © 2026 · Start on