@@ -99,7 +99,7 @@ FileClass* FileClass::constructor(Arguments const& args) {
9999 std::filesystem::create_directories (path.parent_path ());
100100 }
101101 } else {
102- throw CreateExceptionWithInfo (__FUNCTION__, " File " + args[0 ].asString ().toString () + " doesn't exist! " );
102+ throw CreateExceptionWithInfo (__FUNCTION__, " File {} doesn't exist! " , args[0 ].asString ().toString ());
103103 }
104104 FileOpenMode fMode = static_cast <FileOpenMode>(args[1 ].asNumber ().toInt32 ());
105105 // Auto Create
@@ -126,7 +126,7 @@ FileClass* FileClass::constructor(Arguments const& args) {
126126
127127 std::fstream fs (path, mode);
128128 if (!fs.is_open ()) {
129- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to Open File " + path.string () + " ! " );
129+ throw CreateExceptionWithInfo (__FUNCTION__, " Fail to Open File {}! " , path.string ());
130130 }
131131 return new FileClass (args.thiz (), std::move (fs), path.string (), isBinary);
132132 }
@@ -644,10 +644,16 @@ Local<Value> FileWriteTo(Arguments const& args) {
644644 std::error_code code;
645645 std::filesystem::create_directories (path.parent_path (), code);
646646 if (code) {
647- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to create directory " + path.parent_path ().string () + " !" );
647+ throw CreateExceptionWithInfo (
648+ __FUNCTION__,
649+ " Fail to create directory " + path.parent_path ().string () + " !"
650+ );
648651 }
649652 } else {
650- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to create directory of " + args[0 ].asString ().toString () + " !" );
653+ throw CreateExceptionWithInfo (
654+ __FUNCTION__,
655+ " Fail to create directory of " + args[0 ].asString ().toString () + " !"
656+ );
651657 }
652658 return Boolean::newBoolean (ll::file_utils::writeFile (path, args[1 ].asString ().toString (), false ));
653659 }
@@ -665,10 +671,16 @@ Local<Value> FileWriteLine(Arguments const& args) {
665671 std::error_code code;
666672 std::filesystem::create_directories (path.parent_path (), code);
667673 if (code) {
668- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to create directory " + path.parent_path ().string () + " !" );
674+ throw CreateExceptionWithInfo (
675+ __FUNCTION__,
676+ " Fail to create directory " + path.parent_path ().string () + " !"
677+ );
669678 }
670679 } else {
671- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to create directory of " + args[0 ].asString ().toString () + " !" );
680+ throw CreateExceptionWithInfo (
681+ __FUNCTION__,
682+ " Fail to create directory of " + args[0 ].asString ().toString () + " !"
683+ );
672684 }
673685
674686 std::ofstream fileWrite (path, std::ios::app);
@@ -693,10 +705,14 @@ Local<Value> OpenFile(Arguments const& args) {
693705 std::error_code code;
694706 std::filesystem::create_directories (path.parent_path (), code);
695707 if (code) {
696- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to create directory " + path.parent_path ().string () + " !" );
708+ throw CreateExceptionWithInfo (
709+ __FUNCTION__,
710+ " Fail to create directory {}!" ,
711+ path.parent_path ().string ()
712+ );
697713 }
698714 } else {
699- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to create directory " + args[0 ].asString ().toString () + " ! " );
715+ throw CreateExceptionWithInfo (__FUNCTION__, " Fail to create directory {}! " , args[0 ].asString ().toString ());
700716 }
701717
702718 FileOpenMode fMode = static_cast <FileOpenMode>(args[1 ].asNumber ().toInt32 ());
@@ -716,7 +732,7 @@ Local<Value> OpenFile(Arguments const& args) {
716732
717733 std::fstream fs (path, mode);
718734 if (!fs.is_open ()) {
719- throw CreateExceptionWithInfo (__FUNCTION__, " Fail to Open File " + path.string () + " ! " );
735+ throw CreateExceptionWithInfo (__FUNCTION__, " Fail to Open File {}! " , path.string ());
720736 }
721737 return FileClass::newFile (std::move (fs), path.string (), isBinary);
722738 }
0 commit comments