/loggerouter/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerouter/trunk

« back to all changes in this revision

Viewing changes to src/tools.vala

  • Committer: Gustav Hartvigsson
  • Date: 2025-06-03 21:28:25 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20250603212825-d99acf3s4b1qktk3
spellingĀ error

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
  }
32
32
 
33
33
  public static string str_escape_enviorment_variables (string str ) {
34
 
    StringBuilder builder = new StringBuilder ();
35
 
    var enviorment = GLib.Environ.@get ();
36
 
 
37
 
    if (str_starts_with (str, "/")) {
38
 
      builder.append_c ('/');
39
 
    }
40
 
 
41
 
    var tokens = str.split ("/");
42
 
    builder.append (tokens[0]);
43
 
 
44
 
    for (size_t i = 1; i <= tokens.length; i++) {
45
 
      var t = tokens[i];
46
 
 
47
 
      if (str_starts_with (str, "$")) {
48
 
        builder.append (GLib.Environ.get_variable (enviorment, t));
49
 
      } else {
50
 
        builder.append (t);
51
 
      }
52
 
    }
53
 
 
54
 
    if (str_ends_with (str, "/")) {
55
 
      builder.append_c ('/');
56
 
    }
57
 
 
58
 
    return builder.str;
 
34
    return str;
59
35
  }
60
36
 
61
37
 
80
56
#endif
81
57
 
82
58
  // Easier presentation of dialog...
83
 
  void present_dialog (string? format, ...) {
 
59
  void prensent_dialog (string? format, ...) {
84
60
    bool use_fake_main_loop = false;
85
61
    Gtk.Window? parent = null;
86
62
    if (!Gtk.is_initialized ()) {
124
100
    return true;
125
101
  }
126
102
 
127
 
  bool str_ends_with (string stack, string needle) {
128
 
    if (stack.length < needle.length) {
129
 
      return false;
130
 
    }
131
 
    long stack_len = stack.length;
132
 
    for (long i = needle.length; i > 0; i--) {
133
 
      if (stack[i] != needle[stack_len]) {
134
 
        return false;
135
 
      }
136
 
      stack_len--;
137
 
    }
138
 
    return true;
139
 
  }
140
 
 
141
103
 
142
104
  string resolve_path (string path) {
143
105
    string base_dir;