haorenhui
2023-10-30 6d6cc10d9e8e242661da7fd655dec155a09d676c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Quintiq file version 2.0
#parent: #root
StaticMethod GetQuintiqBaseDir () as String
{
  Description: 'Maintain by R&D'
  TextBody:
  [*
    // Dan Roozemond Jun-8-2012 (created)
    
    dir := OS::BinDir();
    
    // Strip trailing slash
    if( dir.Regex( '(\\|/)$' ) )
    {
      dir := dir.Erase(dir.Length() - 1, 1 );
    }
    //Strip the \Bin
    
    if( dir.Regex( '(\\|/)[Bb]in$' ) )
    {
      dir := dir.Erase(dir.Length() - 4, 4 );
    }
    
    // Strip the trailing i if it's of the form " - i"
    while( dir.Regex(' - [0-9]+' ) )
    {
      dir := dir.Erase(dir.Length() - 1, 1 );
    }
    
    return dir;
  *]
}