Class: Applocale::FilePathUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/applocale/Util/file_util.rb

Constant Summary collapse

DIRNAME_MAIN =
'AppLocale'
DIRNAME_IOS =
'IOS'
DIRNAME_ANDROID =
'Android'
FILENAME_CONFIG =
'AppLocaleFile'
FILENAME_XLSX =
'string.xlsx'
GOOGLE_CREDENTIALS =
'google_credentials.yaml'

Class Method Summary collapse

Class Method Details

.default_config_filenameObject



26
27
28
# File 'lib/applocale/Util/file_util.rb', line 26

def self.default_config_filename
  return FILENAME_CONFIG
end

.default_google_credentials_filenameObject



22
23
24
# File 'lib/applocale/Util/file_util.rb', line 22

def self.default_google_credentials_filename
  return GOOGLE_CREDENTIALS
end

.default_localefile_relative_pathstr(platform, lang) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/applocale/Util/file_util.rb', line 34

def self.default_localefile_relative_pathstr(platform, lang)
  if platform == Platform::IOS
    dirname = DIRNAME_IOS
  elsif platform == Platform::ANDROID
    dirname = DIRNAME_ANDROID
  end
  unless dirname.nil?
    filename = Locale.filename(platform, lang)
    return "#{dirname}/#{filename}"
  end
  return nil
end

.default_mainfolderObject



30
31
32
# File 'lib/applocale/Util/file_util.rb', line 30

def self.default_mainfolder
  return DIRNAME_MAIN
end

.default_xlsx_relativepath_strObject



47
48
49
50
# File 'lib/applocale/Util/file_util.rb', line 47

def self.default_xlsx_relativepath_str
  filename = FILENAME_XLSX
  return filename
end

.get_proj_absoluat_path(proj_path) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/applocale/Util/file_util.rb', line 14

def self.get_proj_absoluat_path(proj_path)
  path = proj_path
  if !(Pathname.new proj_path).absolute?
    path = File.expand_path(proj_path,Dir.pwd)
  end
  return path
end

.str_to_folderpathstr(str) ⇒ Object



52
53
54
55
56
57
# File 'lib/applocale/Util/file_util.rb', line 52

def self.str_to_folderpathstr(str)
  pathstr = Pathname.new(str.strip)
  if File.directory?(pathstr)
    pathstr = File.join(self.configfile_pathstr, FilePathUtil.default_config_filename).to_s
  end
end