src/squirrel_std.cpp
branchnoai
changeset 9725 a73b33a966be
parent 9723 eee46cb39750
child 9727 a5fdea13a991
equal deleted inserted replaced
9724:b39bc69bb2f2 9725:a73b33a966be
     3 #include <sqstdio.h>
     3 #include <sqstdio.h>
     4 #include "stdafx.h"
     4 #include "stdafx.h"
     5 #include "debug.h"
     5 #include "debug.h"
     6 #include "squirrel.hpp"
     6 #include "squirrel.hpp"
     7 #include "squirrel_std.hpp"
     7 #include "squirrel_std.hpp"
       
     8 #include "core/alloc_func.hpp"
     8 
     9 
     9 /* abs() is normally defined to myabs(), which we don't want in this file */
    10 /* abs() is normally defined to myabs(), which we don't want in this file */
    10 #undef abs
    11 #undef abs
    11 
    12 
    12 SQInteger SquirrelStd::abs(HSQUIRRELVM vm)
    13 SQInteger SquirrelStd::abs(HSQUIRRELVM vm)
    39 	if (s != NULL) {
    40 	if (s != NULL) {
    40 		/* Keep the PATHSEPCHAR there, remove the rest */
    41 		/* Keep the PATHSEPCHAR there, remove the rest */
    41 		*s++;
    42 		*s++;
    42 		*s = '\0';
    43 		*s = '\0';
    43 	}
    44 	}
    44 	/* And now we concat, so we are relative from the current script */
    45 	/* And now we concat, so we are relative from the current script
       
    46 	 * First, we have to make sure we have enough space for the full path */
       
    47 	real_filename = ReallocT(real_filename, scstrlen(real_filename) + scstrlen(filename) + 1);
    45 	scstrcat(real_filename, filename);
    48 	scstrcat(real_filename, filename);
    46 
    49 
    47 	/* Make sure we are in the root-table, so everything is included in the root-level */
    50 	/* Make sure we are in the root-table, so everything is included in the root-level */
    48 	sq_pushroottable(vm);
    51 	sq_pushroottable(vm);
    49 	/* Compile and load the file */
    52 	/* Compile and load the file */