Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3267 in orxonox.OLD


Ignore:
Timestamp:
Dec 24, 2004, 3:18:11 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/updater: changed the FileInfo-struct

Location:
orxonox/branches/updater/src/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/updater/src/gui/orxonox_gui_update.cc

    r3266 r3267  
    153153  FileInfo* info = new FileInfo;
    154154
    155   info->fileOnDisk = new char [5];
    156   strcpy (info->fileOnDisk, "test");
    157   info->fileOnNet = new char [100];
    158   strcpy(info->fileOnNet, "http://www.orxonox.ethz.ch/files/02%20orxonox%203.mp3");
     155  info->fileName = "03%20orxonox%203'.mp3";
     156  info->webRoot  = "http://www.orxonox.ethz.ch/files/";
     157  info->localRoot = "./";
    159158  info->Bar = (ProgressBar*)bar;
    160   PRINTF(3)("Preparing to download file %s.\n", info->fileOnNet);
     159  PRINTF(3)("Preparing to download file %s.\n", info->fileName);
    161160  //  downloadThread (info);
    162161
    163162  if (downloadThreadID == NULL)
    164163    {
    165         if ( (downloadThreadID =g_thread_create(&downloadThread, info, TRUE, NULL)) == 0 )
    166           PRINTF(1)("can't create the thread");
     164      if ( (downloadThreadID =g_thread_create(&downloadThread, info, TRUE, NULL)) == 0 )
     165        PRINTF(1)("can't create the thread");
    167166    }
    168167  else
     
    218217  FILE* outfile;
    219218  curl = curl_easy_init();
     219  char* fileOnNet = new char [strlen(info->webRoot)+strlen(info->fileName)+1];
     220  strcpy (fileOnNet, info->webRoot);
     221  strcat (fileOnNet, info->fileName);
     222  char* fileOnDisk = new char [strlen(info->localRoot)+strlen(info->fileName)+1];
     223  strcpy (fileOnDisk, info->localRoot);
     224  strcat (fileOnDisk, info->fileName);
    220225
    221226  if(curl)
    222227    {
    223       outfile = fopen(info->fileOnDisk, "w");
     228      outfile = fopen(fileOnDisk, "w");
    224229     
    225       curl_easy_setopt(curl, CURLOPT_URL, info->fileOnNet);
     230      curl_easy_setopt(curl, CURLOPT_URL, fileOnNet);
    226231      curl_easy_setopt(curl, CURLOPT_WRITEDATA, outfile);
    227232      curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curlWriteFunc);
  • orxonox/branches/updater/src/gui/orxonox_gui_update.h

    r3266 r3267  
    3939
    4040#ifdef HAVE_CURL
     41  //! A Struct to hold information about one File to download.
    4142  struct FileInfo
    4243  {
    43     char* fileOnNet;
    44     char* fileOnDisk;
    45     ProgressBar* Bar;
     44    char* fileName;       //!< The Name of the file we want to get.
     45    char* webRoot;        //!< The Root of the File on The Web
     46    char* localRoot;      //!< The Root directory to put the files on the local disk.
     47
     48    ProgressBar* Bar;     //!< The ProgressBar, that sould be updated.
    4649  };
    4750
Note: See TracChangeset for help on using the changeset viewer.