xLua - Lua C++ API

Check-in [9bdc2e0b87]
Login
Overview
Comment:Fix error handling on call to access(2)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:9bdc2e0b87bb80e2e82f6087f66c89f3945faca554f7a492b4c890c3fbc0ee40
User & Date: jmmv@google.com 2014-08-02 02:23:47
Context
2014-08-02
02:23
Allow "make check" to be run when kyua is missing Discovered while trying to setup Travis CI. check-in: dd98dc60f4 user: jmmv@google.com tags: master, trunk
02:23
Fix error handling on call to access(2) check-in: 9bdc2e0b87 user: jmmv@google.com tags: master, trunk
01:59
Forbid creating a distfile when Doxygen is missing "make distcheck" was strangely failing when Doxygen was not present even when the install rules check for this condition. This was because the dist rules were not handling the lack of Doxygen properly. Discovered while trying to set up Travis CI for lutok. check-in: 31daf875d4 user: jmmv@google.com tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to state.cpp.

488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
/// \throw api_error If luaL_loadfile returns an error.
/// \throw file_not_found_error If the file cannot be accessed.
///
/// \warning Terminates execution if there is not enough memory.
void
lutok::state::load_file(const std::string& file)
{
    if (!::access(file.c_str(), R_OK) == 0)
        throw lutok::file_not_found_error(file);
    if (luaL_loadfile(_pimpl->lua_state, file.c_str()) != 0)
        throw lutok::api_error::from_stack(*this, "luaL_loadfile");
}


/// Wrapper around luaL_loadstring.







|







488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
/// \throw api_error If luaL_loadfile returns an error.
/// \throw file_not_found_error If the file cannot be accessed.
///
/// \warning Terminates execution if there is not enough memory.
void
lutok::state::load_file(const std::string& file)
{
    if (::access(file.c_str(), R_OK) == -1)
        throw lutok::file_not_found_error(file);
    if (luaL_loadfile(_pimpl->lua_state, file.c_str()) != 0)
        throw lutok::api_error::from_stack(*this, "luaL_loadfile");
}


/// Wrapper around luaL_loadstring.