feisty meow concerns codebase 2.140
short_path.cpp
Go to the documentation of this file.
1/*****************************************************************************\
2* *
3* Name : short_path *
4* Author : Chris Koeritz *
5* *
6* Purpose: *
7* *
8* This program converts a pathname to its 8.3 name. Only for windows. *
9* *
10*******************************************************************************
11* Copyright (c) 2007-$now By Author. This program is free software; you can *
12* redistribute it and/or modify it under the terms of the GNU General Public *
13* License as published by the Free Software Foundation; either version 2 of *
14* the License or (at your option) any later version. This is online at: *
15* http://www.fsf.org/copyleft/gpl.html *
16* Please send any updates to: fred@gruntose.com *
17\*****************************************************************************/
18
20#include <basis/astring.h>
22
23#include <stdio.h>
24#include <string.h>
25#ifdef __WIN32__
26 #include <windows.h>
27#endif
28
29using namespace basis;
30using namespace structures;
31
33
34int main(int argc, char *argv[])
35{
36 astring shorty('\0', 2048);
37 if (argc < 2) {
38 printf("This program needs a path to convert to its short form.\n");
39 return 23;
40 }
41#ifdef __WIN32__
42 GetShortPathNameA(argv[1], shorty.s(), 2045);
43#else
44 strcpy(shorty.s(), argv[1]);
45#endif
46 shorty.replace_all('\\', '/');
47 printf("%s", shorty.s());
48 return 0;
49}
50
51#ifdef __BUILD_STATIC_APPLICATION__
52 // static dependencies found by buildor_gen_deps.sh:
53 #include <algorithms/sorts.cpp>
56 #include <basis/astring.cpp>
58 #include <basis/environment.cpp>
59 #include <basis/guards.cpp>
60 #include <basis/mutex.cpp>
80 #include <timely/earth_time.cpp>
81 #include <timely/time_stamp.cpp>
82#endif // __BUILD_STATIC_APPLICATION__
83
Provides a dynamically resizable ASCII character string.
Definition astring.h:35
const char * s() const
synonym for observe. the 's' stands for "string", if that helps.
Definition astring.h:113
bool replace_all(char to_replace, char new_char)
changes all occurrences of "to_replace" with "new_char".
Definition astring.cpp:932
The guards collection helps in testing preconditions and reporting errors.
Definition array.h:30
A dynamic container class that holds any kind of object via pointers.
Definition amorph.h:55
int main(int argc, char *argv[])
HOOPLE_STARTUP_CODE;.
Aids in achievement of platform independence.