mirror of https://github.com/aria2/aria2
				
				
				
			2008-05-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Use A2STR::SLASH_C, A2STR::DOT_C instead of "/", "." respectively. * src/A2STR.cc * src/A2STR.h * src/File.ccpull/1/head
							parent
							
								
									1aeefb5c4b
								
							
						
					
					
						commit
						1b874503cf
					
				| 
						 | 
				
			
			@ -1,3 +1,10 @@
 | 
			
		|||
2008-05-14  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 | 
			
		||||
 | 
			
		||||
	Use A2STR::SLASH_C, A2STR::DOT_C instead of "/", "." respectively.
 | 
			
		||||
	* src/A2STR.cc
 | 
			
		||||
	* src/A2STR.h
 | 
			
		||||
	* src/File.cc
 | 
			
		||||
 | 
			
		||||
2008-05-14  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>
 | 
			
		||||
 | 
			
		||||
	Defined static const std::string IP("ip"), PORT("port") and use them
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,4 +46,6 @@ const std::string A2STR::LF_C("\n");
 | 
			
		|||
 | 
			
		||||
const std::string A2STR::SLASH_C("/");
 | 
			
		||||
 | 
			
		||||
const std::string A2STR::DOT_C(".");
 | 
			
		||||
 | 
			
		||||
} // namespace aria2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,6 +52,8 @@ public:
 | 
			
		|||
  static const std::string LF_C;
 | 
			
		||||
 | 
			
		||||
  static const std::string SLASH_C;
 | 
			
		||||
 | 
			
		||||
  static const std::string DOT_C;
 | 
			
		||||
};
 | 
			
		||||
} // namespace aria2
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								src/File.cc
								
								
								
								
							
							
						
						
									
										14
									
								
								src/File.cc
								
								
								
								
							| 
						 | 
				
			
			@ -104,11 +104,11 @@ bool File::mkdirs() {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  std::string accDir;
 | 
			
		||||
  if(Util::startsWith(name, "/")) {
 | 
			
		||||
    accDir = "/";
 | 
			
		||||
  if(Util::startsWith(name, A2STR::SLASH_C)) {
 | 
			
		||||
    accDir = A2STR::SLASH_C;
 | 
			
		||||
  }
 | 
			
		||||
  for(std::deque<std::string>::const_iterator itr = dirs.begin(); itr != dirs.end();
 | 
			
		||||
      itr++, accDir += "/") {
 | 
			
		||||
      itr++, accDir += A2STR::SLASH_C) {
 | 
			
		||||
    accDir += *itr;
 | 
			
		||||
    if(File(accDir).isDir()) {
 | 
			
		||||
      continue;
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +131,7 @@ mode_t File::mode()
 | 
			
		|||
 | 
			
		||||
std::string File::getBasename() const
 | 
			
		||||
{
 | 
			
		||||
  std::string::size_type lastSlashIndex = name.find_last_of("/");
 | 
			
		||||
  std::string::size_type lastSlashIndex = name.find_last_of(A2STR::SLASH_C);
 | 
			
		||||
  if(lastSlashIndex == std::string::npos) {
 | 
			
		||||
    return name;
 | 
			
		||||
  } else {
 | 
			
		||||
| 
						 | 
				
			
			@ -141,15 +141,15 @@ std::string File::getBasename() const
 | 
			
		|||
 | 
			
		||||
std::string File::getDirname() const
 | 
			
		||||
{
 | 
			
		||||
  std::string::size_type lastSlashIndex = name.find_last_of("/");
 | 
			
		||||
  std::string::size_type lastSlashIndex = name.find_last_of(A2STR::SLASH_C);
 | 
			
		||||
  if(lastSlashIndex == std::string::npos) {
 | 
			
		||||
    if(name.empty()) {
 | 
			
		||||
      return A2STR::NIL;
 | 
			
		||||
    } else {
 | 
			
		||||
      return ".";
 | 
			
		||||
      return A2STR::DOT_C;
 | 
			
		||||
    }
 | 
			
		||||
  } else if(lastSlashIndex == 0) {
 | 
			
		||||
    return "/";
 | 
			
		||||
    return A2STR::SLASH_C;
 | 
			
		||||
  } else {
 | 
			
		||||
    return name.substr(0, lastSlashIndex);
 | 
			
		||||
  }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue