Changeset 314 for AE/Installer/trunk
- Timestamp:
- May 3, 2009, 9:38:12 AM (16 years ago)
- Location:
- AE/Installer/trunk/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/Installer/trunk/source/methods.h
r308 r314 79 79 void tokenize(const string&, vector<string>&, const string& delimiters = " "); 80 80 //bool getDirectoryContents(char , char &); 81 82 83 //New copy(path, path) function. Too lazy to implement my own, this is basically how I would have done it though. 84 //No, really. :) 85 //Move to utilities.cpp when the time comes. 86 using namespace boost::filesystem; 87 using namespace std; 88 89 void copy_directory( const path & from_dir_ph, 90 const path & to_dir_ph ); 91 92 void copy( const path & from_file_ph, 93 const path & to_file_ph ); 94 95 96 // this function copies files and directories. If copying a 97 // directory to a directory, it copies recursively. 98 99 //pardon the mess, I did this at midnight, and had to fix a bug 100 void copy( const path & from_ph, 101 const path & to_ph ) 102 { 103 cout << to_ph.string() << "\n"; 104 // Make sure that the destination, if it exists, is a directory 105 if((exists(to_ph) && !is_directory(to_ph)) || (!exists(from_ph))) cout << "error"; 106 if(!is_directory(from_ph)) 107 { 108 109 if(exists(to_ph)) 110 { 111 copy_file(from_ph,to_ph/from_ph.filename()); 112 } 113 else 114 { 115 try{ 116 117 copy_file(from_ph,to_ph); 118 } 119 catch (exception ex){ 120 cout << from_ph.string() << " to " << to_ph.string() << "\n"; 121 } 122 } 123 124 } 125 else if(from_ph.filename() != ".svn") 126 { 127 path destination; 128 if(!exists(to_ph)) 129 { 130 destination=to_ph; 131 } 132 else 133 { 134 destination=to_ph/from_ph.filename(); 135 } 136 //not sure what this did, its going away though. probably error checking ;) 137 //copy_directory(from_ph,destination); 138 139 for(directory_iterator i(from_ph); i!=directory_iterator(); ++i) 140 { 141 //the idiot who coded this in the first place (not me) 142 //forgot to make a new directory. Exception city. x_x 143 create_directory(destination); 144 copy(*i,destination/i->filename()); 145 } 146 } 147 } 148 149 void copy_directory( const path &from_dir_ph, 150 const path &to_dir_ph) 151 { 152 if(!exists(from_dir_ph) || !is_directory(from_dir_ph) 153 || exists(to_dir_ph)) 154 cout << !exists(from_dir_ph) << " " << !is_directory(from_dir_ph) 155 << " " << exists(to_dir_ph); 156 //boost::throw_exception( filesystem_error( 157 //"boost::filesystem::copy_directory", 158 //from_dir_ph, to_dir_ph, boost::system::error_code() )); 159 160 # ifdef BOOST_POSIX 161 struct stat from_stat; 162 if ( (::stat( from_dir_ph.string().c_str(), &from_stat ) != 0) 163 || ::mkdir(to_dir_ph.native_directory_string().c_str(), 164 from_stat.st_mode)!=0) 165 # endif 166 // boost::throw_exception( filesystem_error( 167 // //"boost::filesystem::copy_directory", 168 // from_dir_ph, to_dir_ph, boost::system::error_code())); 169 } 170 -
AE/Installer/trunk/source/subs.cpp
r312 r314 105 105 int err = 0; 106 106 107 107 try { 108 108 int levels[15] = {0, 1, 2, 3, 4, 6, 8, 9, 10, 11, 12, 13, 14, 18, 19}; // the levels Oni has 109 109 char choice = 0; … … 266 266 267 267 create_directory("../GameDataFolder/IGMD"); 268 copy _file("packages/VanillaBSL", "../GameDataFolder/IGMD");268 copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); 269 269 } 270 270 catch (exception ex) {
Note:
See TracChangeset
for help on using the changeset viewer.