OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 if (!file_util::GetTempDir(&temp_path)) { | 389 if (!file_util::GetTempDir(&temp_path)) { |
390 return false; | 390 return false; |
391 } | 391 } |
392 | 392 |
393 String uuid_string = GetUUIDString(); | 393 String uuid_string = GetUUIDString(); |
394 | 394 |
395 // format the temp file basename | 395 // format the temp file basename |
396 String filename; | 396 String filename; |
397 | 397 |
398 // try to retain the original file suffix (.jpg, etc.) | 398 // try to retain the original file suffix (.jpg, etc.) |
399 int dot_position = uri.rfind('.'); | 399 std::string::size_type dot_position = uri.rfind('.'); |
400 if (dot_position != std::string::npos) { | 400 if (dot_position != std::string::npos) { |
401 filename = uuid_string + uri.substr(dot_position); | 401 filename = uuid_string + uri.substr(dot_position); |
402 } else { | 402 } else { |
403 filename = uuid_string; | 403 filename = uuid_string; |
404 } | 404 } |
405 | 405 |
406 // Construct the full pathname | 406 // Construct the full pathname |
407 FilePath fullpath = temp_path; | 407 FilePath fullpath = temp_path; |
408 fullpath = fullpath.AppendASCII(filename); | 408 fullpath = fullpath.AppendASCII(filename); |
409 | 409 |
410 if (temp_fullpath) *temp_fullpath = fullpath; | 410 if (temp_fullpath) *temp_fullpath = fullpath; |
411 | 411 |
412 return true; | 412 return true; |
413 } | 413 } |
414 | 414 |
415 } // namespace o3d | 415 } // namespace o3d |
OLD | NEW |