[tuxdroid-svn] r5610 - software_suite_v3/software/plugin/plugin-twitter/branches/october_release/pl
Status: Beta
Brought to you by:
ks156
|
From: jerome <c2m...@c2...> - 2009-10-08 08:49:25
|
Author: jerome
Date: 2009-10-08 10:49:09 +0200 (Thu, 08 Oct 2009)
New Revision: 5610
Modified:
software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterDatasStruct.java
Log:
* Moved the save file directory ( do not depends on the user session anymore ).
Modified: software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterDatasStruct.java
===================================================================
--- software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterDatasStruct.java 2009-10-08 08:39:55 UTC (rev 5609)
+++ software_suite_v3/software/plugin/plugin-twitter/branches/october_release/plugin-twitter/src/TwitterDatasStruct.java 2009-10-08 08:49:09 UTC (rev 5610)
@@ -27,10 +27,14 @@
import java.io.Serializable;
import java.util.Vector;
+import com.kysoh.SmartCorePaths;
+
public class TwitterDatasStruct extends Object implements Serializable{
private static final long serialVersionUID = 8395814134877723558L;
+ private static String linuxDatasSav = "";
+ private static String windowsDatasSav = "";
public static final byte FRIENDS_STATUSES = 0;
public static final byte REPLIES = 1;
@@ -38,21 +42,64 @@
public SerializedVector vktStruct;
private File structFile;
+ private boolean firstCycle;
+ /**
+ * Path initialization.
+ */
+ static
+ {
+ if ( SmartCorePaths.isLinux() )
+ {
+ TwitterDatasStruct.linuxDatasSav = System.getenv("HOME") + "/.tuxdroid/plugins_conf/Twitter";
+
+ if (! ( new File(linuxDatasSav)).exists())
+ {
+ if ( ! ( new File(linuxDatasSav) ).mkdirs() )
+ {
+ ( new File(linuxDatasSav) ).mkdir();
+ }
+ }
+ }
+ else
+ {
+ TwitterDatasStruct.windowsDatasSav = System.getenv("ALLUSERSDIR") + "/tuxdroid/plugins_conf/Twitter";
+
+ if (! ( new File(windowsDatasSav)).exists())
+ {
+ if ( ! ( new File(windowsDatasSav) ).mkdirs() )
+ {
+ ( new File(windowsDatasSav) ).mkdir();
+ }
+ }
+ }
+ }
+
+
+
public TwitterDatasStruct(String username)
{
- //Getting file where was registered serialized vector.
- File path = new File("");
//tds = tuxdroid datas saved.
- structFile = new File(path.getAbsolutePath() + File.separator + username + "@twitter.sav");
+
+ if (SmartCorePaths.isLinux())
+ {
+ structFile = new File(linuxDatasSav + File.separator + username + "@twitter.sav");
+ }
+ else
+ {
+ structFile = new File(windowsDatasSav + File.separator + username + "@twitter.sav");
+ }
+
if(structFile.exists())
{
//Getting serialized object struct.
+ this.firstCycle = false;
vktStruct = this.loadStruct();
}
else
{
+ this.firstCycle = true;
//Create struct.
vktStruct = new SerializedVector();
if(vktStruct == null)
@@ -145,7 +192,17 @@
}
+
/**
+ * This function return the state of cycle ( first start or not for the current user ).
+ * @return
+ */
+ public boolean isFirstCycle()
+ {
+ return this.firstCycle;
+ }
+
+ /**
* Return true if the target is registered.
* @param list
* @param sender
|