git @ Cat's Eye Technologies linapple / 2.1.1-catseye
Merge branch 'abort-on-resource-not-found' into 2.1.1-catseye Chris Pressey 2 years ago
1 changed file(s) with 17 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
99 #include <iostream>
1010 #include <fcntl.h>
1111 #include <cstdio>
12 #include <stdexcept>
1213
1314 #include "config.h"
1415
8586 "charset40.bmp",
8687 "font.bmp",
8788 "splash.bmp",
88 "Printer.txt",
8989 "Master.dsk",
90 "LICENSE",
9190 "linapple.conf",
9291 "icon.bmp",
9392 ""
112111 mkdir((userDir + CONF_DIRECTORY_NAME).c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
113112 mkdir((userDir + SAVED_DIRECTORY_NAME).c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
114113 mkdir((userDir + FTP_DIRECTORY_NAME).c_str(), S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
114 }
115115
116 cout << "Copying Files\n" << std::endl;
116 cout << "Copying Files" << std::endl;
117 for( unsigned int i = 0; *files[ i ]; i++ ) {
118 string src = (GetInstallPath() + files[ i ]);
119 string dest = (GetUserFilePath() + files[ i ]);
120 if (stat (dest.c_str(), &buffer) == 0) {
121 // It's already there.
122 continue;
123 }
124 if (!(stat (src.c_str(), &buffer) == 0)) {
125 cout << "Could not stat " << src << "." << std::endl;
126 cout << "Please ensure " << GetInstallPath() << " exists and contains the linapple resource files." << std::endl;
127 throw std::runtime_error("could not copy resource files");
128 }
129 CopyFile(src, dest);
130 }
117131
118 // Copy config options file
119 for( unsigned int i = 0; *files[ i ]; i++ ) {
120 string dest = GetUserFilePath();
121 CopyFile(
122 (GetInstallPath() + files[ i ]),
123 dest + files[ i ]
124 );
125 }
126 }
127132 return bResult;
128133 }
129134