Vultraz

Untitled

Mar 20th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. void adjust_profile(std::string& profile)
  2. {
  3.     // Create a temp copy
  4.     std::string temp = profile;
  5.  
  6.     static const std::string path_adjust = "/transparent";
  7.     const std::string::size_type offset = profile.find_last_of('/', profile.find('~'));
  8.  
  9.     // If the path already refers to /transparent...
  10.     if(profile.find(path_adjust) && offset != std::string::npos) {
  11.         if(!image::locator(profile).file_exists()) {
  12.             profile.replace(profile.find(path_adjust), path_adjust.length(), "");
  13.         }
  14.  
  15.         return;
  16.     }
  17.  
  18.     // else, check for the file with /transparent appended...
  19.     offset != std::string::npos ?
  20.         temp.insert(offset, path_adjust) : temp = path_adjust + temp;
  21.  
  22.     // and use that path if it exists
  23.     if(image::locator(temp).file_exists()) {
  24.         profile = temp;
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment