'use strict';

// Load requirements
const path = require('path'),
      fs = require('fs'),
      os = require('os');

// Load modules
const utils = require(__base + 'libs/utils');

module.exports = {
  type: 'input',
  name: 'temp',
  message: 'Fantastic! Just one last thing before we move on, where is your temp directory?\n',
  default: os.tmpdir() + ( os.platform() === 'win32' ? '\\' : '/' ),
  when: () => {
    return true;
  },
  validate: (val, answers) => {

    if ( ! val.match(/[/|\/]$/) ) {
      return 'Paths must end with a slash';
    }

    if ( ! fs.existsSync(val) || ! fs.lstatSync(val).isDirectory() ) {
      return 'Path either does not exist or is not a directory';
    }

    return true;
  }
};

@@ -120,16 +120,20 @@
 // Load 
+our 
 modules%0A
@@ -176,16 +176,55 @@
 /utils')
+,%0A      config = require('../config')()
 ;%0A%0Amodul
@@ -285,91 +285,54 @@
 ge: 
-'Fantastic! Just one last thing before we move on, where is your temp directory?%5Cn'
+utils.colorString(lang('setup.temp.question'))
 ,%0A  
@@ -422,57 +422,256 @@
     
-return true;%0A  %7D,%0A  validate: (val, answers) =%3E %7B
+utils.output(lang('setup.temp.title'), lang('setup.temp.message.why') + '%5Cn%5Cn' + lang('setup.temp.message.options'), 4, 6);%0A    return true;%0A  %7D,%0A  validate: (val, answers) =%3E %7B%0A%0A    val = val.trim();%0A%0A    if( val === '') %7B%0A      return true;%0A    %7D
 %0A%0A  
@@ -721,37 +721,43 @@
 urn 
-'Paths must end with a 
+lang('setup.temp.validation.
 slash'
+)
 ;%0A  
@@ -849,58 +849,47 @@
 urn 
-'Path either does not exist or is not a directory'
+lang('setup.temp.validation.not_found')
 ;%0A  

Update setup temp to use new language strings and add validation