Fix linux/mac support.
authorDavid Anderson <dvander@alliedmods.net>
Tue Jan 01 16:28:34 2013 -0800 (2013-01-01)
changeset 2521dee2330aa78
parent 251 ca99a81745fe
child 253 544c478362c2
Fix linux/mac support.
src/Packages.cpp
src/Platform-Posix.cpp
src/compiler/CompileContext.cpp
src/compiler/Parser.cpp
     1.1 --- a/src/Packages.cpp	Tue Jan 01 15:34:07 2013 -0800
     1.2 +++ b/src/Packages.cpp	Tue Jan 01 16:28:34 2013 -0800
     1.3 @@ -15,6 +15,7 @@
     1.4   * You should have received a copy of the GNU General Public License along with
     1.5   * SourcePawn. If not, see http://www.gnu.org/licenses/.
     1.6   */
     1.7 +#include <string.h>
     1.8  #include "Zone.h"
     1.9  #include "Heap.h"
    1.10  #include "Strings.h"
     2.1 --- a/src/Platform-Posix.cpp	Tue Jan 01 15:34:07 2013 -0800
     2.2 +++ b/src/Platform-Posix.cpp	Tue Jan 01 16:28:34 2013 -0800
     2.3 @@ -17,6 +17,7 @@
     2.4   * JITCraft. If not, see http://www.gnu.org/licenses/.
     2.5   */
     2.6  #include <sys/mman.h>
     2.7 +#include <sys/stat.h>
     2.8  #include <limits.h>
     2.9  #include <string.h>
    2.10  #include <stdlib.h>
    2.11 @@ -154,3 +155,19 @@
    2.12      return "/";
    2.13  }
    2.14  
    2.15 +OS::PathType
    2.16 +OS::InspectPath(const char *path)
    2.17 +{
    2.18 +    struct stat s;
    2.19 +    int result = stat(path, &s);
    2.20 +    if (result != 0)
    2.21 +        return OS::Path_Invalid;
    2.22 +
    2.23 +    if (s.st_mode & S_IFDIR)
    2.24 +        return OS::Path_Folder;
    2.25 +    if (s.st_mode & S_IFREG)
    2.26 +        return OS::Path_File;
    2.27 +
    2.28 +    return OS::Path_Invalid;
    2.29 +}
    2.30 +
     3.1 --- a/src/compiler/CompileContext.cpp	Tue Jan 01 15:34:07 2013 -0800
     3.2 +++ b/src/compiler/CompileContext.cpp	Tue Jan 01 16:28:34 2013 -0800
     3.3 @@ -16,6 +16,7 @@
     3.4   * SourcePawn. If not, see http://www.gnu.org/licenses/.
     3.5   */
     3.6  #include <stdio.h>
     3.7 +#include <string.h>
     3.8  #include "../Zone.h"
     3.9  #include "../Interpreter.h"
    3.10  #include "../Packages.h"
     4.1 --- a/src/compiler/Parser.cpp	Tue Jan 01 15:34:07 2013 -0800
     4.2 +++ b/src/compiler/Parser.cpp	Tue Jan 01 16:28:34 2013 -0800
     4.3 @@ -1244,8 +1244,6 @@
     4.4  ImportStatement *
     4.5  Parser::import()
     4.6  {
     4.7 -    NameList *names = new (pool_) NameList();
     4.8 -
     4.9      SourcePosition pos = scanner_.begin();
    4.10  
    4.11      // import       ::= import_path ("." "*")?