import opts
`{
-#include <errno.h>
+ #include <errno.h>
+ #include <string.h>
`}
# Local config
# Modify these according to your needs. It is also possible to have alternates
# using class refinment and a main calling to super.
class Config
+ # Is it configured? Change to "true" when the configuration has been
+ # adapted to your needs and setup
+ var is_configured = false
+
# Source directory where are the files to be sorted.
var source_dir = "~/Downloads/"
end
# Returns null on success
- fun file_rename_to(dest: String): nullable String import String::to_cstring,
- String::from_cstring, String as nullable `{
- int res = rename(String_to_cstring(recv), String_to_cstring(dest));
+ fun file_rename_to(dest: String): nullable String import String.to_cstring,
+ NativeString.to_s, String.as nullable `{
+ int res = rename(String_to_cstring(self), String_to_cstring(dest));
if (res == 0) return null_String();
- return String_as_nullable(new_String_from_cstring(strerror(errno)));
+ return String_as_nullable(NativeString_to_s(strerror(errno)));
`}
# Replace `~` by the path to the home diretory
class PatternWithDir
super BM_Pattern
- var dir: String
+ var dir: String is noinit
init with_dir(motif, dir: String)
do
end
var config = new Config
+if not config.is_configured then
+ print "Not configured, make sure you modify the script and set is_configured to true"
+ exit 1
+end
var sorter = new XySorter
# calculate cut off time using `elapsed_days` compared to now