Reorganize
This commit is contained in:
36
szlib/helper_procs.odin
Normal file
36
szlib/helper_procs.odin
Normal file
@@ -0,0 +1,36 @@
|
||||
package szlib
|
||||
|
||||
import sp "core:path/slashpath"
|
||||
import "core:crypto"
|
||||
import "core:encoding/uuid"
|
||||
import "core:os/os2"
|
||||
|
||||
get_data_directory :: proc() -> (result: string, error: os2.Error) {
|
||||
exe_dir, err := os2.get_executable_directory(context.allocator)
|
||||
if err != os2.General_Error.None {
|
||||
return "", error
|
||||
}
|
||||
|
||||
data_path := sp.join({exe_dir, "data"})
|
||||
if (!os2.is_directory(data_path))
|
||||
{
|
||||
mkdir_err := os2.make_directory(data_path)
|
||||
if mkdir_err != os2.General_Error.None
|
||||
{
|
||||
return "", mkdir_err
|
||||
}
|
||||
}
|
||||
|
||||
return data_path, os2.General_Error.None
|
||||
}
|
||||
|
||||
create_uuid :: proc() -> string {
|
||||
new_uuid: string
|
||||
|
||||
{
|
||||
context.random_generator = crypto.random_generator()
|
||||
new_uuid = uuid.to_string_allocated(uuid.generate_v7())
|
||||
}
|
||||
|
||||
return new_uuid
|
||||
}
|
||||
Reference in New Issue
Block a user