Questions tagged [cross-platform]

An attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms.

A cross-platform application is an application that can run on multiple operating systems (or platforms).

Cross-platform software may be divided into two types; one requires individual building or compilation for each platform that it supports, and the other one can be directly run on any platform without special preparation, e.g., software written in an interpreted language or pre-compiled portable bytecode for which the interpreters or run-time packages are common or standard components of all platforms.

For example, a cross-platform application may run on Microsoft Windows on the x86 architecture, Linux on the x86 architecture and Mac OS X on either the PowerPC or x86 based Apple Macintosh systems. A cross-platform application may run on as many as all existing platforms, or on as few as two platforms.

For a bit more details, see this : http://en.wikipedia.org/wiki/Cross-platform

6015 questions
1182
votes
5 answers

What is a cross-platform way to get the home directory?

I need to get the location of the home directory of the current logged-on user. Currently, I've been using the following on Linux: os.getenv("HOME") However, this does not work on Windows. What is the correct cross-platform way to do this ?
Nathan Osman
  • 71,149
  • 71
  • 256
  • 361
924
votes
27 answers

How to identify which OS Python is running on

What do I need to look at to see whether I'm on Windows or Unix, etc.?
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
680
votes
9 answers

What's the strategy for handling CRLF (carriage return, line feed) with Git?

I tried committing files with CRLF-ending lines, but it failed. I spent a whole work day on my Windows computer trying different strategies and was almost drawn to stop trying to use Git and instead try Mercurial. How to properly handle CRLF line…
Daniel Jomphe
  • 16,991
  • 5
  • 29
  • 30
628
votes
26 answers

How to get current time and date in C++?

Is there a cross-platform way to get the current date and time in C++?
Max Frai
  • 61,946
  • 78
  • 197
  • 306
588
votes
10 answers

How do I get a platform-independent new line character?

How do I get a platform-independent newline in Java? I can’t use "\n" everywhere.
Spoike
  • 119,724
  • 44
  • 140
  • 158
563
votes
5 answers

What is "stdafx.h" used for in Visual Studio?

A file named stdafx.h is automatically generated when I start a project in Visual Studio 2010. I need to make a cross-platform C++ library, so I don't/can't use this header file. What is stdafx.h used for? Is it OK that I just remove this header…
prosseek
  • 182,215
  • 215
  • 566
  • 871
562
votes
8 answers

What's the best way to check if a file exists in C?

Is there a better way than simply trying to open the file? int exists(const char *fname) { FILE *file; if ((file = fopen(fname, "r"))) { fclose(file); return 1; } return 0; }
Dave Marshall
  • 7,367
  • 4
  • 22
  • 15
454
votes
10 answers

How to check if running in Cygwin, Mac or Linux?

I have a shell script that is used both on Windows/Cygwin and Mac and Linux. It needs slightly different variables for each versions. How can a shell/bash script detect whether it is running in Cygwin, on a Mac or in Linux?
bastibe
  • 16,551
  • 28
  • 95
  • 126
369
votes
5 answers

Cross-platform way of getting temp directory in Python

Is there a cross-platform way of getting the path to the temp directory in Python 2.6? For example, under Linux that would be /tmp, while under XP C:\Documents and settings\[user]\Application settings\Temp.
Joril
  • 19,961
  • 13
  • 71
  • 88
357
votes
9 answers

What is the best way to find the user's home directory in Java?

What is the best way to find the user's home directory in Java? The difficulty is that the solution should be cross-platform; it should work on Windows 2000, XP, Vista, OS X, Linux, and other Unix variants. I am looking for a snippet of code that…
Bruno Ranschaert
  • 7,428
  • 5
  • 36
  • 46
342
votes
3 answers

How to detect reliably Mac OS X, iOS, Linux, Windows in C preprocessor?

If there's some cross-platform C/C++ code that should be compiled on Mac OS X, iOS, Linux, Windows, how can I detect them reliably during preprocessor process?
eonil
  • 83,476
  • 81
  • 317
  • 516
339
votes
5 answers

How can I find the current OS in Python?

As the title says, how can I find the current operating system in python?
UnkwnTech
  • 88,102
  • 65
  • 184
  • 229
336
votes
14 answers

How do you run a Python script as a service in Windows?

I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other…
Hanno Fietz
  • 30,799
  • 47
  • 148
  • 234
306
votes
8 answers

What is the naming standard for path components?

I keep getting myself in knots when I am manipulating paths and file names because I don’t follow a naming standard for path components. Consider the following toy problem (Windows example, but hopefully the answer should be platform independent).…
Oddthinking
  • 24,359
  • 19
  • 83
  • 121
246
votes
7 answers

Difference between "\n" and Environment.NewLine

What is the difference between two, if any (with respect to .Net)?
Prerak K
  • 10,940
  • 7
  • 30
  • 37
1
2 3
99 100