Changeset 968

Show
Ignore:
Timestamp:
11/08/08 14:25:29 (2 months ago)
Author:
liamMT
Message:

- escape spaces in filepath for files to be uploaded

Location:
mchelper/branches/v25
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • mchelper/branches/v25/include/Preferences.h

    r832 r968  
    1414#define DEFAULT_CHECK_UPDATES true 
    1515 
    16 #ifdef Q_WS_WIN 
    17   #define DEFAULT_SAM7_PATH "C:\something\sam7.exe" 
    18 #else 
    19   #define DEFAULT_SAM7_PATH "/usr/bin/sam7" 
    20 #endif 
     16#define DEFAULT_SAM7_PATH "/usr/bin/sam7" // only relevant for *nix  
    2117 
    2218class MainWindow; 
  • mchelper/branches/v25/src/Inspector.cpp

    r963 r968  
    116116  { 
    117117    msgs << QString( "/system/name %1" ).arg( QString( "\"%1\"" ).arg( newName ) ); 
    118     mainWindow->setBoardName( board->key(), QString( "%1 : %2" ).arg(newName).arg(board->location()) ); 
     118    mainWindow->setBoardName( board->key(), QString( "%1 : %2" ).arg(newName).arg(board->key()) ); 
    119119  } 
    120120     
  • mchelper/branches/v25/src/Uploader.cpp

    r966 r968  
    6161  CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); 
    6262  CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, kCFURLPOSIXPathStyle); 
    63   QString uploaderName = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding()); 
    64   uploaderName += "/Contents/Resources/sam7"; 
     63  QDir appBundle( CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding()) ); 
     64  QString uploaderName = appBundle.filePath( "Contents/Resources/sam7" ); 
    6565  #elif defined (Q_WS_WIN) 
    6666  QString uploaderName = QDir::current().filePath("sam7"); 
     
    6969  QString uploaderName = settings.value("sam7_path", DEFAULT_SAM7_PATH).toString(); 
    7070  #endif 
     71  int offset = 0; // escape any spaces in the filename 
     72  do 
     73  { 
     74    offset = filename.indexOf(" ", offset); 
     75    if( offset != -1 ) 
     76    { 
     77      filename.insert(offset, "\\"); 
     78      offset += 2; // step past the \ we inserted and the space we put it in front of 
     79    } 
     80  } while( offset != -1 ); 
     81  qDebug( "uploading %s", qPrintable(filename)); 
     82   
    7183  QStringList uploaderArgs; 
    7284  uploaderArgs << "-e" << "set_clock";