OSDN Git Service

[core] :
authorcaprice <caprice@users.sourceforge.jp>
Sun, 11 Aug 2013 16:48:21 +0000 (01:48 +0900)
committercaprice <caprice@users.sourceforge.jp>
Sun, 11 Aug 2013 16:48:21 +0000 (01:48 +0900)
* struct information - メンバ変数への const の付加
* extension() - typo の修正
* ~extension() - typo の修正

core/include/extension.hpp

index 3ff9b23..ec45233 100644 (file)
@@ -23,21 +23,21 @@ public:
     typedef std::function<void () noexcept> finalize_handler_type;
     
     struct information {
-        mona_string name;
-        vm_type lua_obj;
+        const mona_string name;
+        const vm_type lua_obj;
         bool is_packaged;
     };
     
     extension() {
-        if(boost::filesystem::exist(path)) {
-            boost::filesystem::create_directory(unpacked_extension_path);
+        if(boost::filesystem::exists(unpacked_extension_path)) {
+            boost::filesystem::create_directories(unpacked_extension_path);
         }
         instance = this;
     }
     
     ~extension() {
         boost::system::error_code dummy;
-        boost::filesystem::remove_directory(unpacked_extension_path, dummy);
+        boost::filesystem::remove_all(unpacked_extension_path, dummy);
     }
     
     static extension *get_instance() { return instance; }
@@ -48,7 +48,7 @@ public:
         if(ext_path.get_ext() == "gep") {
             // エクステンションはパッケージ化されている
             
-            information ext_info = {"", luaL_newstate(""), true};
+            information ext_info = {"", luaL_newstate(), true};
             
             extension_table[ext_info.name] = ext_info;
         } else if(ext_path.get_ext() == "gex") {
@@ -57,7 +57,7 @@ public:
     }
 private:
     std::unordered_map<extension_id_type, information> extension_table;
-    const boost::filesystem::path unpacked_extension_path = ".tmp.unpacked-ext";
+    const boost::filesystem::path unpacked_extension_path = ".tmp/unpacked-ext";
     static self_type *instance;
     
     initialize_handler_type init_func;