X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScripting%2FNasalSGPath.cxx;h=19a74aff2a0d6c0952498c5dab72ee8e10c7c9e7;hb=9c63b7713307eb4db9f6df7959fe83977f561c42;hp=1addac2471f0d7a7632bd0e56da7ec889bb2480a;hpb=61da998e02d04e230daa6a986af4912562aeed36;p=flightgear.git diff --git a/src/Scripting/NasalSGPath.cxx b/src/Scripting/NasalSGPath.cxx index 1addac247..19a74aff2 100644 --- a/src/Scripting/NasalSGPath.cxx +++ b/src/Scripting/NasalSGPath.cxx @@ -25,8 +25,9 @@ #include
#include -#include -#include +#include +#include + #include #include @@ -59,6 +60,12 @@ static naRef f_new_path(const nasal::CallContext& ctx) return validatedPathToNasal(ctx, SGPath(ctx.getArg(0))); } +static int f_path_create_dir(SGPath& p, const nasal::CallContext& ctx) +{ + // limit setable access rights for Nasal + return p.create_dir(ctx.getArg(0, 0755) & 0775); +} + /** * os.path.desktop() */ @@ -125,10 +132,10 @@ naRef initNasalSGPath(naRef globals, naContext c) .method("isAbsolute", &SGPath::isAbsolute) .method("isNull", &SGPath::isNull) - .method("create_dir", &SGPath::create_dir) + .method("create_dir", &f_path_create_dir) .method("remove", &SGPath::remove) .method("rename", &SGPath::rename); - + nasal::Hash globals_module(globals, c), path = globals_module.createHash("os") .createHash("path");