AdvC++ - zadanie ze zmianą permission plików zrobione
This commit is contained in:
parent
02f8913275
commit
8b0352bde6
1 changed files with 13 additions and 1 deletions
|
|
@ -30,6 +30,18 @@ void printPermissionsForDir() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void changePermissions() {
|
void changePermissions() {
|
||||||
|
for (const auto& entry : fs::directory_iterator(fs::current_path().string() + "/project")) {
|
||||||
|
if (fs::is_regular_file(entry.path())) {
|
||||||
|
fs::perms p = fs::perms::none;
|
||||||
|
using per = fs::perms;
|
||||||
|
if(entry.path().extension() == ".exe"){
|
||||||
|
p = per::owner_all | per::group_read | per::group_write | per::others_read | per::others_write;
|
||||||
|
} else if(entry.path().extension() == ".cpp" || entry.path().extension() == ".hpp"){
|
||||||
|
p = per::owner_read | per::owner_write | per::group_read | per::others_read;
|
||||||
|
}
|
||||||
|
fs::permissions(entry.path(), p);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
@ -49,4 +61,4 @@ int main() {
|
||||||
std::cout << "files which were longest unmodified: \n";
|
std::cout << "files which were longest unmodified: \n";
|
||||||
// Print it here
|
// Print it here
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue