Skip to content

Commit c97f2c3

Browse files
committed
Update
1 parent 919ab8e commit c97f2c3

File tree

3 files changed

+25
-20
lines changed

3 files changed

+25
-20
lines changed

c/functions.c

+14-15
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ struct TidyResult{
1919
TidyBoolean error;
2020
};
2121
typedef struct TidyResult TidyResult;
22-
23-
TidyBoolean tidyFML_exists(const char[] tidyPath){
22+
TidyBoolean tidyFML_exists(const char tidyPath[]){
2423
#ifdef _WIN32
2524
DWORD tidyAttributes = GetFileAttributes(tidyPath);
2625
if(tidyAttributes != INVALID_FILE_ATTRIBUTES){
@@ -39,7 +38,7 @@ TidyBoolean tidyFML_exists(const char[] tidyPath){
3938
#endif
4039
}
4140

42-
TidyResult tidyFML_isFolder(const char[] tidyPath){
41+
TidyResult tidyFML_isFolder(const char tidyPath[]){
4342
TidyResult resultHere;
4443
#ifdef _WIN32
4544
DWORD tidyAttributes = getFileAttributes(tidyPath);
@@ -59,7 +58,7 @@ TidyResult tidyFML_isFolder(const char[] tidyPath){
5958
if(stat(tidyPath, &tidyPathStat) != 0){
6059
resultHere.error = TRUE;
6160
}
62-
if(S_ISDIR(tidyathStat.st_mode)){
61+
if(S_ISDIR(tidyPathStat.st_mode)){
6362
resultHere.error = FALSE;
6463
resultHere.result = TRUE;
6564
}
@@ -71,7 +70,7 @@ TidyResult tidyFML_isFolder(const char[] tidyPath){
7170
return resultHere;
7271
}
7372

74-
TidyResult tidyFML_isFile(const char[] tidyPath){
73+
TidyResult tidyFML_isFile(const char tidyPath[]){
7574
TidyResult resultHere;
7675
#ifdef _WIN32
7776
DWORD tidyAttributes = getFileAttributes(tidyPath);
@@ -91,7 +90,7 @@ TidyResult tidyFML_isFile(const char[] tidyPath){
9190
if(stat(tidyPath, &tidyPathStat) != 0){
9291
resultHere.error = TRUE;
9392
}
94-
if(S_ISREG(tidyathStat.st_mode)){
93+
if(S_ISREG(tidyPathStat.st_mode)){
9594
resultHere.error = FALSE;
9695
resultHere.result = TRUE;
9796
}
@@ -103,7 +102,7 @@ TidyResult tidyFML_isFile(const char[] tidyPath){
103102
return resultHere;
104103
}
105104

106-
TidyBoolean tidyFML_createFolder(char[] tidyPath){
105+
TidyBoolean tidyFML_createFolder(const char tidyPath[]){
107106
#ifdef _WIN32
108107
if(CreateDirectory(tidyPath, NULL)){
109108
return TRUE;
@@ -121,9 +120,9 @@ TidyBoolean tidyFML_createFolder(char[] tidyPath){
121120
#endif
122121
}
123122

124-
TidyBoolean tidyFML_delete(char[] tidyPath){
123+
TidyBoolean tidyFML_delete(const char tidyPath[]){
125124
TidyResult tidyIsFile = tidyFML_isFile(tidyPath);
126-
TidyResult tidyIsDirectory = tidyFML_isDirectory(tidyPath)
125+
TidyResult tidyIsDirectory = tidyFML_isFolder(tidyPath);
127126
if(tidyIsFile.error == FALSE && tidyIsFile.result == TRUE){
128127
#ifdef _WIN32
129128
if(DeleteFile(tidyPath)){
@@ -141,7 +140,7 @@ TidyBoolean tidyFML_delete(char[] tidyPath){
141140
}
142141
#endif
143142
}
144-
if(tidyIsDirectory.error == FALSE && tidyIsDirectory.result = TRUE){
143+
if(tidyIsDirectory.error == FALSE && tidyIsDirectory.result == TRUE){
145144
#ifdef _WIN32
146145
if(RemoveDirectory(tidyPath)){
147146
return TRUE;
@@ -160,18 +159,18 @@ TidyBoolean tidyFML_delete(char[] tidyPath){
160159
}
161160
}
162161

163-
TidyBoolean tidyFML_createFile(char[] tidyPath){
162+
TidyBoolean tidyFML_createFile(const char tidyPath[]){
164163
FILE* fileHere = fopen(tidyPath, "w");
165164
if(fileHere == NULL){
166-
return FALSE
165+
return FALSE;
167166
}
168167
if(fclose(fileHere) != 0){
169-
return FALSE
168+
return FALSE;
170169
}
171-
return TRUE
170+
return TRUE;
172171
}
173172

174-
TidyBoolean tidyFML_clear(char[] tidyPath){
173+
TidyBoolean tidyFML_clear(const char tidyPath[]){
175174
if(tidyFML_delete(tidyPath) == FALSE){
176175
return FALSE;
177176
}
1.12 KB
Binary file not shown.

java/java-function-are-here.java renamed to java/TidyOpenFileManagementLibrary.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import java.io.file;
1+
import java.io.*;
22

3-
public class TidyOpenFileManagementLibrary(){
3+
public class TidyOpenFileManagementLibrary{
44
public boolean exists(String tidyPath){
55
return (new File(tidyPath)).exists();
66
}
@@ -11,13 +11,19 @@ public boolean isFile(String tidyPath){
1111
return (new File(tidyPath)).isFile();
1212
}
1313
public boolean createFolder(String tidyPath){
14-
return (new File(tidyPath)).mkdir(tidyPath);
14+
return (new File(tidyPath)).mkdir();
1515
}
1616
public boolean delete(String tidyPath){
17-
return (new File(tidyPath)).delete(tidyPath);
17+
return (new File(tidyPath)).delete();
1818
}
1919
public boolean createFile(String tidyPath){
20-
return (new File(tidyPath)).createNewFile();
20+
try{
21+
(new File(tidyPath)).createNewFile();
22+
return true;
23+
}
24+
catch(IOException eIsHere){
25+
return false;
26+
}
2127
}
2228
public long size(String tidyPath){
2329
return (new File(tidyPath)).length();

0 commit comments

Comments
 (0)